Class: Date
- Inherits:
-
Object
- Object
- Date
- Defined in:
- lib/core_ext/date.rb
Instance Method Summary collapse
-
#to_local_time ⇒ Object
Returns a local Time object denoting the start (in local time) of the chronological Julian day represented by the Date.
-
#to_utc_time ⇒ Object
Returns a UTC Time object denoting the start (in UTC) of the chronological Julian day represented by the Date.
Instance Method Details
#to_local_time ⇒ Object
Returns a local Time object denoting the start (in local time) of the chronological Julian day represented by the Date. Note that Time objects always use the Gregorian calendar to calculate civil coordinates such as month, day and year. This method is intended to replace the standard Date#to_time method, which produces invalid Time objects for Dates which use the Julian calendar.
12 13 14 |
# File 'lib/core_ext/date.rb', line 12 def to_local_time Time.local(*gregorian_civil_coordinates) end |
#to_utc_time ⇒ Object
Returns a UTC Time object denoting the start (in UTC) of the chronological Julian day represented by the Date. Note that Time objects always use the Gregorian calendar to calculate civil coordinates such as month, day and year.
20 21 22 |
# File 'lib/core_ext/date.rb', line 20 def to_utc_time Time.utc(*gregorian_civil_coordinates) end |