Provide low‐level support functions for proleptic Gregorian dates.

Synopsis

Declared in <bdlt_prolepticdateimputil.h>

struct ProlepticDateImpUtil;

Description

This struct provides a namespace for a suite of pure functions that perform low‐level operations on date values in a variety of formats: year/month/day, year/day‐of‐year, and serial date. Dates in the range [0001/01/01 .. 9999/12/31] that are valid per the proleptic Gregorian calendar are supported, with serial date 1 (3652059) corresponding to 0001/01/01 (9999/12/31). Note that all of the functions, whether or not implemented in terms of a static cache, are stateless, and, as such, are inherently thread‐safe.

Static Member Functions

Name

Description

isLeapYear

Return true if the specified year is a leap year, and false otherwise. The behavior is undefined unless 1 <= year <= 9999.

isValidSerial

Return true if serialDay is a valid serial date value.

isValidYearDay

Return true if year/`dayOfYear` is a valid date value.

isValidYearMonthDay

Return true if year/`month`/`day` is a valid date value.

isValidYearMonthDayNoCache

Return whether year/`month`/`day` is valid without using the cache.

lastDayOfMonth

Return the last day of the specified month in the specified year.

numLeapYears

Return the number of leap years between year1 and year2.

serialToDay

Return the day of the month for the specified serial date.

serialToDayNoCache

Return the day of month for serialDay without using the cache.

serialToDayOfWeek

Return the day of the week for the specified serial date.

serialToDayOfYear

Return the day of the year for the specified serial date.

serialToMonth

Return the month for the specified serial date.

serialToMonthNoCache

Return the month for serialDay without using the date cache.

serialToYd

Load the year‐day representation of the specified serial date.

serialToYear

Return the year for the specified serial date.

serialToYearNoCache

Return the year for serialDay without using the date cache.

serialToYmd

Load the year/month/day representation of the specified serial date.

serialToYmdNoCache

Load YMD for serialDay without using the date cache.

ydToDay

Return the day of the month for the specified year and day‐of‐year.

ydToDayOfWeek

Return the day of the week for the specified year and day‐of‐year.

ydToMd

Load the month and day for the specified year and day‐of‐year.

ydToMonth

Return the month for the specified year and day‐of‐year.

ydToSerial

Return the serial date for the specified year and day‐of‐year.

ymdToDayOfWeek

Return the day of the week for the specified year, month, and day.

ymdToDayOfYear

Return the day of the year for the specified year, month, and day.

ymdToSerial

Return the serial date for the specified year, month, and day.

ymdToSerialNoCache

Return the serial date for YMD without using the date cache.

Created with MrDocs