Class: DateTime
- Includes:
- TimeFunctions
- Defined in:
- lib/sequel/fos_dates.rb
Class Method Summary collapse
-
.from_fos_date_time(days, minutes) ⇒ Object
creates utc time from days and minutes.
-
.from_fos_time(minutes) ⇒ Object
(also: from_minutes)
using a date of 2000,1,1 is arbitrary.
Instance Method Summary collapse
-
#long_view ⇒ Object
This is a view “February 01, 2010 01:40” that be parsed directly by javascript ie.
-
#to_date ⇒ Object
Converts self to a Ruby Date object; time portion is discarded.
- #view ⇒ Object
Methods included from TimeFunctions
#as_minutes, #hm, #in_hundredths, #in_hundredths_rounded_xos, #in_tenths_rounded_xos, #to_fos_days
Class Method Details
.from_fos_date_time(days, minutes) ⇒ Object
creates utc time from days and minutes
117 118 119 120 121 |
# File 'lib/sequel/fos_dates.rb', line 117 def self.from_fos_date_time(days, minutes) days = 0 unless days minutes = 0 unless minutes (Date.from_fos_days(days).to_gm_time + minutes.minutes).to_datetime end |
Instance Method Details
#long_view ⇒ Object
This is a view “February 01, 2010 01:40” that be parsed directly by javascript ie. in javascript you can say: Date.parse( “this to long view” ) and you will get a date object
134 135 136 |
# File 'lib/sequel/fos_dates.rb', line 134 def long_view self.strftime('%B %d, %Y %H:%M') end |
#to_date ⇒ Object
Converts self to a Ruby Date object; time portion is discarded
139 140 141 |
# File 'lib/sequel/fos_dates.rb', line 139 def to_date ::Date.new(year, month, day) end |
#view ⇒ Object
127 128 129 |
# File 'lib/sequel/fos_dates.rb', line 127 def view to_s end |