Method: RubyXL::Workbook#num_to_date
- Defined in:
- lib/rubyXL/objects/workbook.rb
permalink #num_to_date(num) ⇒ Object
[View source]
430 431 432 433 434 435 436 437 438 439 440 |
# File 'lib/rubyXL/objects/workbook.rb', line 430 def num_to_date(num) return nil if num.nil? # Bug-for-bug Excel compatibility (https://support.microsoft.com/kb/214058/) if num < MARCH_1_1900 then num += 1 unless workbook_properties&.date1904 end dateparts = num.divmod(1) base_date + (dateparts[0] + ((dateparts[1] * 86400).round(6) / 86400)) end |