LibreOffice Module comphelper (master) 1
|
Functions | |
sal_Int32 | convertDateToDaysNormalizing (sal_uInt16 nDay, sal_uInt16 nMonth, sal_Int16 nYear) |
Obtain days from zero for a given date, with normalizing. More... | |
bool | isValidDate (sal_uInt16 nDay, sal_uInt16 nMonth, sal_Int16 nYear) |
Whether date is a valid date. More... | |
void | convertDaysToDate (sal_Int32 nDays, sal_uInt16 &rDay, sal_uInt16 &rMonth, sal_Int16 &rYear) |
Obtain date for a days from zero value. More... | |
bool | normalize (sal_uInt16 &rDay, sal_uInt16 &rMonth, sal_Int16 &rYear) |
Normalize date, i.e. More... | |
constexpr sal_Int32 | YearToDays (sal_Int16 nYear) |
Days until start of year from zero, so month and day of month can be added. More... | |
constexpr bool | isLeapYear (sal_Int16 nYear) |
Whether year is a leap year. More... | |
constexpr sal_uInt16 | getDaysInMonth (sal_uInt16 nMonth, sal_Int16 nYear) |
Get number of days in month of year. More... | |
constexpr sal_Int32 | convertDateToDays (sal_uInt16 nDay, sal_uInt16 nMonth, sal_Int16 nYear) |
Obtain days from zero for a given date, without normalizing. More... | |
Variables | |
constexpr sal_Int32 | MIN_DAYS = -11968265 |
constexpr sal_Int32 | MAX_DAYS = 11967900 |
constexpr sal_Int16 | kYearMax = SAL_MAX_INT16 |
constexpr sal_Int16 | kYearMin = SAL_MIN_INT16 |
constexpr sal_Int32 | nNullDateDays = convertDateToDays(30, 12, 1899) |
|
inlineconstexpr |
Obtain days from zero for a given date, without normalizing.
nDay, nMonth, nYear MUST form a valid proleptic Gregorian calendar date.
Definition at line 82 of file date.hxx.
References getDaysInMonth(), i, and YearToDays().
Referenced by convertDateToDaysNormalizing().
COMPHELPER_DLLPUBLIC sal_Int32 comphelper::date::convertDateToDaysNormalizing | ( | sal_uInt16 | nDay, |
sal_uInt16 | nMonth, | ||
sal_Int16 | nYear | ||
) |
Obtain days from zero for a given date, with normalizing.
nDay, nMonth, nYear may be out-of-bounds and are adjusted/normalized.
nYear | Must be != 0, unless nMonth > 12. |
Definition at line 48 of file date.cxx.
References convertDateToDays(), nNullDateDays, and normalize().
COMPHELPER_DLLPUBLIC void comphelper::date::convertDaysToDate | ( | sal_Int32 | nDays, |
sal_uInt16 & | rDay, | ||
sal_uInt16 & | rMonth, | ||
sal_Int16 & | rYear | ||
) |
Obtain date for a days from zero value.
Definition at line 69 of file date.cxx.
References getDaysInMonth(), i, isLeapYear(), kYearMax, kYearMin, MAX_DAYS, MIN_DAYS, and YearToDays().
|
inlineconstexpr |
Get number of days in month of year.
nYear | MUST be != 0. |
Definition at line 67 of file date.hxx.
References isLeapYear(), and n.
Referenced by convertDateToDays(), convertDaysToDate(), isValidDate(), and normalize().
|
inlineconstexpr |
Whether year is a leap year.
Leap years BCE are -1, -5, -9, ... See https://en.wikipedia.org/wiki/Proleptic_Gregorian_calendar#Usage https://en.wikipedia.org/wiki/0_(year)#History_of_astronomical_usage
nYear | MUST be != 0. |
Definition at line 54 of file date.hxx.
Referenced by convertDaysToDate(), and getDaysInMonth().
COMPHELPER_DLLPUBLIC bool comphelper::date::isValidDate | ( | sal_uInt16 | nDay, |
sal_uInt16 | nMonth, | ||
sal_Int16 | nYear | ||
) |
Whether date is a valid date.
Definition at line 58 of file date.cxx.
References getDaysInMonth().
Referenced by normalize().
COMPHELPER_DLLPUBLIC bool comphelper::date::normalize | ( | sal_uInt16 & | rDay, |
sal_uInt16 & | rMonth, | ||
sal_Int16 & | rYear | ||
) |
Normalize date, i.e.
add days or months to form a proper proleptic Gregorian calendar date, unless all values are 0.
rYear | Must be != 0, unless rMonth > 12. |
Definition at line 127 of file date.cxx.
References getDaysInMonth(), isValidDate(), kYearMax, and kYearMin.
Referenced by convertDateToDaysNormalizing().
|
inlineconstexpr |
Days until start of year from zero, so month and day of month can be added.
year 1 => 0 days, year 2 => 365 days, ... year -1 => -366 days, year -2 => -731 days, ...
nYear | MUST be != 0. |
Definition at line 37 of file date.hxx.
References y.
Referenced by convertDateToDays(), and convertDaysToDate().
|
constexpr |
Definition at line 42 of file date.cxx.
Referenced by convertDaysToDate(), and normalize().
|
constexpr |
Definition at line 43 of file date.cxx.
Referenced by convertDaysToDate(), and normalize().
|
constexpr |
Definition at line 40 of file date.cxx.
Referenced by convertDaysToDate().
|
constexpr |
Definition at line 39 of file date.cxx.
Referenced by convertDaysToDate().
|
constexpr |
Definition at line 45 of file date.cxx.
Referenced by convertDateToDaysNormalizing().