Class: Time

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

Instance Method Summary collapse

Instance Method Details

#to_dateObject



1788
1789
1790
1791
# File 'lib/rubysl/date/date.rb', line 1788

def to_date
  jd = Date.__send__(:civil_to_jd, year, mon, mday, Date::GREGORIAN)
  Date.new!(Date.__send__(:jd_to_ajd, jd, 0, 0), 0, Date::ITALY)
end

#to_datetimeObject



1793
1794
1795
1796
1797
1798
1799
1800
# File 'lib/rubysl/date/date.rb', line 1793

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

#to_timeObject



1786
# File 'lib/rubysl/date/date.rb', line 1786

def to_time() getlocal end