Class: Time

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

Instance Method Summary collapse

Instance Method Details

#to_dateObject



21
22
23
24
25
# File 'lib/supplement/date.rb', line 21

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



26
27
28
29
30
31
32
33
# File 'lib/supplement/date.rb', line 26

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



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

def to_time ; self ; end