Class: DateTime

Inherits:
Object
  • Object
show all
Extended by:
UnixEpoch::ClassMethods
Includes:
UnixEpoch::InstanceMethods
Defined in:
lib/unix_epoch.rb

Class Method Summary collapse

Methods included from UnixEpoch::ClassMethods

from_unix_ts

Methods included from UnixEpoch::InstanceMethods

#to_i, #to_unix_ts

Class Method Details

.from_jd(jd, fr, of = 0, sg = ITALY) ⇒ Object

Create a new DateTime object from a given JD

sg specifies the Day of Calendar Reform.



135
136
137
138
# File 'lib/unix_epoch.rb', line 135

def self.from_jd(jd, fr, of = 0, sg=ITALY)
    of = Rational(of, 86_400) if of != 0 and not of.kind_of? Rational
    new!(jd_to_ajd(jd, fr, of), of, sg)
end