Skip to content

Instantly share code, notes, and snippets.

Created July 28, 2009 03:05
Show Gist options
  • Save anonymous/156897 to your computer and use it in GitHub Desktop.
Save anonymous/156897 to your computer and use it in GitHub Desktop.
def day_suffix(number)
if number == "1"
"st"
elsif number == "2"
"nd"
elsif number == "3"
"rd"
else
"th"
end
end
@current_time = Time.now
@current_day = @current_time.strftime("%d")
@day_ending = day_suffix(@current_day.split(//).last)
puts "#{@current_day}#{@day_ending}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment