Revisions
-
pkieltyka revised this gist
Jul 28, 2009 . 1 changed file with 17 additions and 15 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,17 +1,19 @@ def day_with_suffix(d = Time.now) current_day = d.strftime("%d") day_number = current_day.split(//).last suffix = case day_number when 1 "st" when 2 "nd" when 3 "rd" else "th" end return "#{current_day}#{suffix}" end puts day_with_suffix -
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,17 @@ 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}"