Module: XlsFunction::Converters::DateSerialConverter
- Defined in:
- lib/xls_function/converters/date_serial_converter.rb
Constant Summary collapse
- ORIGIN =
Date.new(1899, 12, 31).freeze
Class Method Summary collapse
Class Method Details
.date_to_serial(date) ⇒ Object
7 8 9 |
# File 'lib/xls_function/converters/date_serial_converter.rb', line 7 def date_to_serial(date) (date.to_date - ORIGIN).to_d(15) end |
.serial_to_date(serial) ⇒ Object
11 12 13 |
# File 'lib/xls_function/converters/date_serial_converter.rb', line 11 def serial_to_date(serial) ORIGIN + serial.to_i end |