Class: Time

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

Instance Method Summary collapse

Instance Method Details

#to_dateObject



52
53
54
55
56
# File 'lib/supplement/date.rb', line 52

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



57
58
59
60
61
62
63
64
# File 'lib/supplement/date.rb', line 57

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



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

def to_time ; self ; end