BloombergLP::bdlt::ProlepticDateImpUtil

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.

Synopsis

Declared in <bdlt_prolepticdateimputil.h>

struct ProlepticDateImpUtil;

Static Member Functions

NameDescription
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 the specified serialDay represents a valid date value, and false otherwise. Note that valid date values are (as fully defined in the component-level documentation) in the range [1 .. 3652059].
isValidYearDay Return true if the specified year and dayOfYear represents a valid date value, and false otherwise. Note that valid date values are (as fully defined in the component-level documentation) in the range [0001/01 .. 9999/366].
isValidYearMonthDay Return true if the specified year, month, and day represents a valid date value, and false otherwise. Note that valid date values are (as fully defined in the component-level documentation) in the range [0001/01/01 .. 9999/12/31].
isValidYearMonthDayNoCache Return true if the specified year, month, and day represents a valid date value, and false otherwise. Note that valid date values are (as fully defined in the component-level documentation) in the range [0001/01/01 .. 9999/12/31]. Also note that this function is guaranteed not to use any date-cache optimizations.
lastDayOfMonth Return the last day of the specified month in the specified year. The behavior is undefined unless 1 <= year <= 9999 and 1 <= month <= 12. Note that the value returned will be in the range [28 .. 31].
numLeapYears Return the number of leap years occurring between the specified year1 and year2, inclusive. The behavior is undefined unless 1 <= year1 <= 9999, 1 <= year2 <= 9999, and year1 <= year2.
serialToDay Return the day (of the month) of the date value indicated by the specified serialDay. The behavior is undefined unless isValidSerial(serialDay) returns true.
serialToDayNoCache Return the day (of the month) of the date value indicated by the specified serialDay. The behavior is undefined unless isValidSerial(serialDay) returns true. Note that this function is guaranteed not to use any date-cache optimizations.
serialToDayOfWeek Return, as an integer (with 1 = SUN, 2 = MON, ..., 7 = SAT), the day (of the week) of the date value indicated by the specified serialDay. The behavior is undefined unless isValidSerial(serialDay) returns true.
serialToDayOfYear Return the day of the year of the date value indicated by the specified serialDay. The behavior is undefined unless isValidSerial(serialDay) returns true.
serialToMonth Return the month of the date value indicated by the specified serialDay. The behavior is undefined unless isValidSerial(serialDay) returns true.
serialToMonthNoCache Return the month of the date value indicated by the specified serialDay. The behavior is undefined unless isValidSerial(serialDay) returns true. Note that this function is guaranteed not to use any date-cache optimizations.
serialToYd Load, into the specified year and dayOfYear, the year-day representation of the date value indicated by the specified serialDay. The behavior is undefined unless isValidSerial(serialDay) returns true.
serialToYear Return the year of the date value indicated by the specified serialDay. The behavior is undefined unless isValidSerial(serialDay) returns true.
serialToYearNoCache Return the year of the date value indicated by the specified serialDay. The behavior is undefined unless isValidSerial(serialDay) returns true. Note that this function is guaranteed not to use any date-cache optimizations.
serialToYmd Load, into the specified year, month, and day, the date value indicated by the specified serialDay. The behavior is undefined unless isValidSerial(serialDay) returns true.
serialToYmdNoCache Load, into the specified year, month, and day, the date value indicated by the specified serialDay. The behavior is undefined unless isValidSerial(serialDay) returns true. Note that this function is guaranteed not to use any date-cache-optimizations.
ydToDay Return the day (of the month) of the date value indicated by the specified year and dayOfYear. The behavior is undefined unless isValidYearDay(year, dayOfYear) returns true.
ydToDayOfWeek Return, as an integer (with 1 = SUN, 2 = MON, ..., 7 = SAT), the day (of the week) of the date value indicated by the specified year and dayOfYear. The behavior is undefined unless isValidYearDay(year, dayOfYear) returns true.
ydToMd Load, into the specified month and day, the (partial) calendar date representation of the date value indicated by the specified year and dayOfYear. The behavior is undefined unless isValidYearDay(year, dayOfYear) returns true.
ydToMonth Return the month of the date value indicated by the specified year and dayOfYear. The behavior is undefined unless isValidYearDay(year, dayOfYear) returns true.
ydToSerial Return the serial date representation of the date value indicated by the specified year and dayOfYear. The behavior is undefined unless isValidYearDay(year, dayOfYear) returns true.
ymdToDayOfWeek Return, as an integer (with 1 = SUN, 2 = MON, ..., 7 = SAT), the day (of the week) of the date value indicated by the specified year, month, and day. The behavior is undefined unless isValidYearMonthDay(year, month, day) returns true.
ymdToDayOfYear Return the day of the year of the date value indicated by the specified year, month, and day. The behavior is undefined unless isValidYearMonthDay(year, month, day) returns true.
ymdToSerial Return the serial date representation of the date value indicated by the specified year, month, and day. The behavior is undefined unless isValidYearMonthDay(year, month, day) returns true.
ymdToSerialNoCache Return the serial date representation of the date value indicated by the specified year, month, and day. The behavior is undefined unless isValidYearMonthDay(year, month, day) returns true. Note that this function is guaranteed not to use any date-cache optimizations.