module DatetimeHelper ## Ex. 2013 def year_for(tach) unless tach.blank? tach.strftime("%Y") end end ## Ex. December def month_name_for(tach) unless tach.blank? tach.strftime("%B") end end ## Ex. Dec def abbr_month_name_for(tach) unless tach.blank? tach.strftime("%b") end end ## Ex. 4 def day_number_for(tach) unless tach.blank? tach.strftime("%e") end end ## Ex. Wednesday def day_name_for(tach) unless tach.blank? tach.strftime("%A") end end ## Ex. Wed def abbr_day_name_for(tach) unless tach.blank? tach.strftime("%a") end end ## Ex. 07:13 PM def twelve_hour_time_for(tach) unless tach.blank? tach.strftime("%I:%M %p") end end ## Ex. 07:13 PM EST def twelve_hour_time_with_timezone_for(tach) unless tach.blank? tach.strftime("%I:%M %p") end end ## Ex. 19:12 def twenty_four_hour_time_for(tach) unless tach.blank? tach.strftime("%H:%M") end end ## Ex. 19:12 EST def twenty_four_hour_time_with_timezone_for(tach) unless tach.blank? tach.strftime("%H:%M %Z") end end ## Ex. December 4 at 07:11 PM def month_day_and_time_for(tach) unless tach.blank? tach.strftime("%B %e at %I:%M %p") end end ## Ex. Dec 4 at 07:11 PM def abbr_month_day_and_time_for(tach) unless tach.blank? tach.strftime("%b %e at %I:%M %p") end end ## Ex. December 4 at 07:11 PM EST def month_day_and_time_with_timezone_for(tach) unless tach.blank? tach.strftime("%B %e at %I:%M %p %Z") end end ## Ex. Dec 4 at 07:11 PM EST def abbr_month_day_and_time_with_timezone_for(tach) unless tach.blank? tach.strftime("%b %e at %I:%M %p %Z") end end ## Ex. December 4, 2013 at 07:11 PM def datetime_for(tach) unless tach.blank? tach.strftime("%B %e, %Y at %I:%M %p") end end ## Ex. Dec 4, 2013 at 07:11 PM def abbr_datetime_for(tach) unless tach.blank? tach.strftime("%b %e, %Y at %I:%M %p") end end ## Ex. December 4, 2013 at 07:11 PM EST def datetime_with_timezone_for(tach) unless tach.blank? tach.strftime("%B %e, %Y at %I:%M %p %Z") end end ## Ex. Dec 4, 2013 at 07:11 PM EST def abbr_datetime_with_timezone_for(tach) unless tach.blank? tach.strftime("%b %e, %Y at %I:%M %p %Z") end end ## Ex. December 4, 2013 def date_for(tach) unless tach.blank? tach.strftime("%B %e, %Y") end end ## Ex. Dec 4, 2013 def abbr_date_for(tach) unless tach.blank? tach.strftime("%b %e, %Y") end end ## Ex. December 4 def month_and_day_for(tach) unless tach.blank? tach.strftime("%B %e") end end ## Ex. Dec 4 def abbr_month_and_day_for(tach) unless tach.blank? tach.strftime("%b %e") end end ## Ex. EST def timezone_name_for(tach) unless tach.blank? tach.strftime("%Z") end end end