Module: DatetimeHelper

Defined in:
app/helpers/datetime_helper.rb

Instance Method Summary collapse

Instance Method Details

#abbr_date_for(tach) ⇒ Object

Ex. Dec 4, 2013



137
138
139
140
141
# File 'app/helpers/datetime_helper.rb', line 137

def abbr_date_for(tach)
  unless tach.blank?
    tach.strftime("%b %e, %Y")
  end
end

#abbr_datetime_for(tach) ⇒ Object

Ex. Dec 4, 2013 at 07:11 PM



109
110
111
112
113
# File 'app/helpers/datetime_helper.rb', line 109

def abbr_datetime_for(tach)
  unless tach.blank?
    tach.strftime("%b %e, %Y at %I:%M %p")
  end
end

#abbr_datetime_with_timezone_for(tach) ⇒ Object

Ex. Dec 4, 2013 at 07:11 PM EST



123
124
125
126
127
# File 'app/helpers/datetime_helper.rb', line 123

def abbr_datetime_with_timezone_for(tach)
  unless tach.blank?
    tach.strftime("%b %e, %Y at %I:%M %p %Z")
  end
end

#abbr_day_name_for(tach) ⇒ Object

Ex. Wed



39
40
41
42
43
# File 'app/helpers/datetime_helper.rb', line 39

def abbr_day_name_for(tach)
  unless tach.blank?
    tach.strftime("%a")
  end
end

#abbr_month_and_day_for(tach) ⇒ Object

Ex. Dec 4



151
152
153
154
155
# File 'app/helpers/datetime_helper.rb', line 151

def abbr_month_and_day_for(tach)
  unless tach.blank?
    tach.strftime("%b %e")
  end
end

#abbr_month_day_and_time_for(tach) ⇒ Object

Ex. Dec 4 at 07:11 PM



81
82
83
84
85
# File 'app/helpers/datetime_helper.rb', line 81

def abbr_month_day_and_time_for(tach)
  unless tach.blank?
    tach.strftime("%b %e at %I:%M %p")
  end
end

#abbr_month_day_and_time_with_timezone_for(tach) ⇒ Object

Ex. Dec 4 at 07:11 PM EST



95
96
97
98
99
# File 'app/helpers/datetime_helper.rb', line 95

def abbr_month_day_and_time_with_timezone_for(tach)
  unless tach.blank?
    tach.strftime("%b %e at %I:%M %p %Z")
  end
end

#abbr_month_name_for(tach) ⇒ Object

Ex. Dec



18
19
20
21
22
# File 'app/helpers/datetime_helper.rb', line 18

def abbr_month_name_for(tach)
  unless tach.blank?
    tach.strftime("%b")
  end
end

#date_for(tach) ⇒ Object

Ex. December 4, 2013



130
131
132
133
134
# File 'app/helpers/datetime_helper.rb', line 130

def date_for(tach)
  unless tach.blank?
    tach.strftime("%B %e, %Y")
  end
end

#datetime_for(tach) ⇒ Object

Ex. December 4, 2013 at 07:11 PM



102
103
104
105
106
# File 'app/helpers/datetime_helper.rb', line 102

def datetime_for(tach)
  unless tach.blank?
    tach.strftime("%B %e, %Y at %I:%M %p")
  end
end

#datetime_with_timezone_for(tach) ⇒ Object

Ex. December 4, 2013 at 07:11 PM EST



116
117
118
119
120
# File 'app/helpers/datetime_helper.rb', line 116

def datetime_with_timezone_for(tach)
  unless tach.blank?
    tach.strftime("%B %e, %Y at %I:%M %p %Z")
  end
end

#day_name_for(tach) ⇒ Object

Ex. Wednesday



32
33
34
35
36
# File 'app/helpers/datetime_helper.rb', line 32

def day_name_for(tach)
  unless tach.blank?
    tach.strftime("%A")
  end
end

#day_number_for(tach) ⇒ Object

Ex. 4



25
26
27
28
29
# File 'app/helpers/datetime_helper.rb', line 25

def day_number_for(tach)
  unless tach.blank?
    tach.strftime("%e")
  end
end

#month_and_day_for(tach) ⇒ Object

Ex. December 4



144
145
146
147
148
# File 'app/helpers/datetime_helper.rb', line 144

def month_and_day_for(tach)
  unless tach.blank?
    tach.strftime("%B %e")
  end
end

#month_day_and_time_for(tach) ⇒ Object

Ex. December 4 at 07:11 PM



74
75
76
77
78
# File 'app/helpers/datetime_helper.rb', line 74

def month_day_and_time_for(tach)
  unless tach.blank?
    tach.strftime("%B %e at %I:%M %p")
  end
end

#month_day_and_time_with_timezone_for(tach) ⇒ Object

Ex. December 4 at 07:11 PM EST



88
89
90
91
92
# File 'app/helpers/datetime_helper.rb', line 88

def month_day_and_time_with_timezone_for(tach)
  unless tach.blank?
    tach.strftime("%B %e at %I:%M %p %Z")
  end
end

#month_name_for(tach) ⇒ Object

Ex. December



11
12
13
14
15
# File 'app/helpers/datetime_helper.rb', line 11

def month_name_for(tach)
  unless tach.blank?
    tach.strftime("%B")
  end
end

#timezone_name_for(tach) ⇒ Object

Ex. EST



158
159
160
161
162
# File 'app/helpers/datetime_helper.rb', line 158

def timezone_name_for(tach)
  unless tach.blank?
    tach.strftime("%Z")
  end
end

#twelve_hour_time_for(tach) ⇒ Object

Ex. 07:13 PM



46
47
48
49
50
# File 'app/helpers/datetime_helper.rb', line 46

def twelve_hour_time_for(tach)
  unless tach.blank?
    tach.strftime("%I:%M %p")
  end
end

#twelve_hour_time_with_timezone_for(tach) ⇒ Object

Ex. 07:13 PM EST



53
54
55
56
57
# File 'app/helpers/datetime_helper.rb', line 53

def twelve_hour_time_with_timezone_for(tach)
  unless tach.blank?
    tach.strftime("%I:%M %p")
  end
end

#twenty_four_hour_time_for(tach) ⇒ Object

Ex. 19:12



60
61
62
63
64
# File 'app/helpers/datetime_helper.rb', line 60

def twenty_four_hour_time_for(tach)
  unless tach.blank?
    tach.strftime("%H:%M")
  end
end

#twenty_four_hour_time_with_timezone_for(tach) ⇒ Object

Ex. 19:12 EST



67
68
69
70
71
# File 'app/helpers/datetime_helper.rb', line 67

def twenty_four_hour_time_with_timezone_for(tach)
  unless tach.blank?
    tach.strftime("%H:%M %Z")
  end
end

#year_for(tach) ⇒ Object

Ex. 2013



4
5
6
7
8
# File 'app/helpers/datetime_helper.rb', line 4

def year_for(tach)
  unless tach.blank?
    tach.strftime("%Y")
  end
end