Package io.keikai.model.impl.sys
Class CalendarUtilImpl
java.lang.Object
io.keikai.model.impl.sys.CalendarUtilImpl
- All Implemented Interfaces:
CalendarUtil
Converts between
Date and Excel's serial date number
(days since 1899-12-30 in 1900-windowing mode, days since 1903-12-31 in
1904-windowing mode; fractional days encode time-of-day).
POI removal: clean-room reimplementation derived from
Excel's documented date-serial behaviour and ECMA-376 Part 1 ยง18.17.4.1.
Algorithm matches Apache POI's DateUtil (Apache License 2.0)
to keep on-disk semantics identical:
- 1900-mode: serial 1 = 1900-01-01; serial 60 is reserved for the fictitious 1900-02-29 (Excel preserves Lotus 1-2-3's bug for interchange compatibility).
- 1904-mode: serial 0 = 1904-01-01.
- Hours/minutes/seconds/millis are extracted from the local-zone
calendar fields rather than from
Date.getTime()to avoid DST-induced drift (POI behaviour, seeDateUtil#getExcelDate).
- Since:
- 3.5.0
- Author:
- dennis
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondoubledateToDoubleValue(Date value) doubledateToDoubleValue(Date date, boolean date1904) doubleValueToDate(double val) doubleValueToDate(double date, boolean date1904)
-
Constructor Details
-
CalendarUtilImpl
public CalendarUtilImpl()
-
-
Method Details
-
doubleValueToDate
- Specified by:
doubleValueToDatein interfaceCalendarUtil
-
dateToDoubleValue
- Specified by:
dateToDoubleValuein interfaceCalendarUtil
-
doubleValueToDate
- Specified by:
doubleValueToDatein interfaceCalendarUtil
-
dateToDoubleValue
- Specified by:
dateToDoubleValuein interfaceCalendarUtil
-