Class: Date

Inherits:
Object show all
Defined in:
lib/sequel/fos_dates.rb

Constant Summary collapse

FOS_JD_OFFSET_DAYS =
Date.parse('1899-12-31').jd

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.from_fos_days(days) ⇒ Object



6
7
8
# File 'lib/sequel/fos_dates.rb', line 6

def self.from_fos_days(days)
  self.jd(FOS_JD_OFFSET_DAYS + days)
end

Instance Method Details

#to_fos_daysObject



10
11
12
# File 'lib/sequel/fos_dates.rb', line 10

def to_fos_days
  jd - FOS_JD_OFFSET_DAYS
end

#to_gm_timeObject

from Ruby Cookbook #########



15
16
17
# File 'lib/sequel/fos_dates.rb', line 15

def to_gm_time
  to_time_special(new_offset, :gm)
end

#to_local_timeObject



19
20
21
# File 'lib/sequel/fos_dates.rb', line 19

def to_local_time
  to_time_special(new_offset(DateTime.now.offset-offset), :local)
end