Class: Time

Inherits:
Object
  • Object
show all
Defined in:
lib/supplement/date.rb

Instance Method Summary collapse

Instance Method Details

#to_dateObject



94
95
96
97
98
# File 'lib/supplement/date.rb', line 94

def to_date
  jd = Date.civil_to_jd year, mon, mday, Date::ITALY
  hd = Date.jd_to_ajd jd, 0, 0
  Date.new! hd, 0, Date::ITALY
end

#to_datetimeObject



99
100
101
102
103
104
105
106
# File 'lib/supplement/date.rb', line 99

def to_datetime
  jd = DateTime.civil_to_jd year, mon, mday, DateTime::ITALY
  fr = DateTime.time_to_day_fraction hour, min, [sec, 59].min
  fr += (Rational usec, 86400*1000000000)
  of = (Rational utc_offset, 86400)
  hd = DateTime.jd_to_ajd jd, fr, of
  DateTime.new! hd, of, DateTime::ITALY
end

#to_timeObject



93
# File 'lib/supplement/date.rb', line 93

def to_time ; self ; end