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



175
176
177
178
179
180
181
# File 'app/helpers/datetime_helper.rb', line 175

def abbr_date_for(tach)
  if tach.blank?
    "Datetime N/A"
  else
    tach.strftime("%b %e, %Y")
  end
end

#abbr_datetime_for(tach) ⇒ Object

Ex. Dec 4, 2013 at 07:11 PM



139
140
141
142
143
144
145
# File 'app/helpers/datetime_helper.rb', line 139

def abbr_datetime_for(tach)
  if tach.blank?
    "Datetime N/A"
  else
    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



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

def abbr_datetime_with_timezone_for(tach)
  if tach.blank?
    "Datetime N/A"
  else
    tach.strftime("%b %e, %Y at %I:%M %p %Z")
  end
end

#abbr_day_name_for(tach) ⇒ Object

Ex. Wed



49
50
51
52
53
54
55
# File 'app/helpers/datetime_helper.rb', line 49

def abbr_day_name_for(tach)
  if tach.blank?
    "Datetime N/A"
  else
    tach.strftime("%a")
  end
end

#abbr_month_and_day_for(tach) ⇒ Object

Ex. Dec 4



193
194
195
196
197
198
199
# File 'app/helpers/datetime_helper.rb', line 193

def abbr_month_and_day_for(tach)
  if tach.blank?
    "Datetime N/A"
  else
    tach.strftime("%b %e")
  end
end

#abbr_month_day_and_time_for(tach) ⇒ Object

Ex. Dec 4 at 07:11 PM



103
104
105
106
107
108
109
# File 'app/helpers/datetime_helper.rb', line 103

def abbr_month_day_and_time_for(tach)
  if tach.blank?
    "Datetime N/A"
  else
    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



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

def abbr_month_day_and_time_with_timezone_for(tach)
  if tach.blank?
    "Datetime N/A"
  else
    tach.strftime("%b %e at %I:%M %p %Z")
  end
end

#abbr_month_name_for(tach) ⇒ Object

Ex. Dec



22
23
24
25
26
27
28
# File 'app/helpers/datetime_helper.rb', line 22

def abbr_month_name_for(tach)
  if tach.blank?
    "Datetime N/A"
  else
    tach.strftime("%b")
  end
end

#date_for(tach) ⇒ Object

Ex. December 4, 2013



166
167
168
169
170
171
172
# File 'app/helpers/datetime_helper.rb', line 166

def date_for(tach)
  if tach.blank?
    "Datetime N/A"
  else
    tach.strftime("%B %e, %Y")
  end
end

#datetime_for(tach) ⇒ Object

Ex. December 4, 2013 at 07:11 PM



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

def datetime_for(tach)
  if tach.blank?
    "Datetime N/A"
  else
    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



148
149
150
151
152
153
154
# File 'app/helpers/datetime_helper.rb', line 148

def datetime_with_timezone_for(tach)
  if tach.blank?
    "Datetime N/A"
  else
    tach.strftime("%B %e, %Y at %I:%M %p %Z")
  end
end

#day_name_for(tach) ⇒ Object

Ex. Wednesday



40
41
42
43
44
45
46
# File 'app/helpers/datetime_helper.rb', line 40

def day_name_for(tach)
  if tach.blank?
    "Datetime N/A"
  else
    tach.strftime("%A")
  end
end

#day_number_for(tach) ⇒ Object

Ex. 4



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

def day_number_for(tach)
  if tach.blank?
    "Datetime N/A"
  else
    tach.strftime("%e")
  end
end

#month_and_day_for(tach) ⇒ Object

Ex. December 4



184
185
186
187
188
189
190
# File 'app/helpers/datetime_helper.rb', line 184

def month_and_day_for(tach)
  if tach.blank?
    "Datetime N/A"
  else
    tach.strftime("%B %e")
  end
end

#month_day_and_time_for(tach) ⇒ Object

Ex. December 4 at 07:11 PM



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

def month_day_and_time_for(tach)
  if tach.blank?
    "Datetime N/A"
  else
    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



112
113
114
115
116
117
118
# File 'app/helpers/datetime_helper.rb', line 112

def month_day_and_time_with_timezone_for(tach)
  if tach.blank?
    "Datetime N/A"
  else
    tach.strftime("%B %e at %I:%M %p %Z")
  end
end

#month_name_for(tach) ⇒ Object

Ex. December



13
14
15
16
17
18
19
# File 'app/helpers/datetime_helper.rb', line 13

def month_name_for(tach)
  if tach.blank?
    "Datetime N/A"
  else
    tach.strftime("%B")
  end
end

#timezone_name_for(tach) ⇒ Object

Ex. EST



202
203
204
205
206
207
208
# File 'app/helpers/datetime_helper.rb', line 202

def timezone_name_for(tach)
  if tach.blank?
    "Datetime N/A"
  else
    tach.strftime("%Z")
  end
end

#twelve_hour_time_for(tach) ⇒ Object

Ex. 07:13 PM



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

def twelve_hour_time_for(tach)
  if tach.blank?
    "Datetime N/A"
  else
    tach.strftime("%I:%M %p")
  end
end

#twelve_hour_time_with_timezone_for(tach) ⇒ Object

Ex. 07:13 PM EST



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

def twelve_hour_time_with_timezone_for(tach)
  if tach.blank?
    "Datetime N/A"
  else
    tach.strftime("%I:%M %p")
  end
end

#twenty_four_hour_time_for(tach) ⇒ Object

Ex. 19:12



76
77
78
79
80
81
82
# File 'app/helpers/datetime_helper.rb', line 76

def twenty_four_hour_time_for(tach)
  if tach.blank?
    "Datetime N/A"
  else
    tach.strftime("%H:%M")
  end
end

#twenty_four_hour_time_with_timezone_for(tach) ⇒ Object

Ex. 19:12 EST



85
86
87
88
89
90
91
# File 'app/helpers/datetime_helper.rb', line 85

def twenty_four_hour_time_with_timezone_for(tach)
  if tach.blank?
    "Datetime N/A"
  else
    tach.strftime("%H:%M %Z")
  end
end

#year_for(tach) ⇒ Object

Ex. 2013



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

def year_for(tach)
  if tach.blank?
    "Datetime N/A"
  else
    tach.strftime("%Y")
  end
end