BloombergLP::bdlt::Date

Value-semantic type representing a date in the Unix (POSIX) calendar.

Synopsis

Declared in <bdlt_date.h>

class Date;

Description

This class implements a complex-constrained, value-semantic type for representing dates according to the Unix (POSIX) calendar. Each object of this class always represents a valid date value in the range [0001JAN01 .. 9999DEC31] inclusive. The interface of this class supports Date values expressed in terms of either year/month/day (the canonical representation) or year/day-of-year (an alternate representation). See []Date Values and Their Representations) for details.

Member Functions

NameDescription
Date [constructor]Constructors
~Date [destructor]Destroy this object.
operator= Assign to this object the value of the specified rhs date, and return a reference providing modifiable access to this object.
addDaysIfValid Add numDays if the result is a supported date; otherwise do nothing.
bdexStreamIn Assign to this object the value read from the specified BDEX stream.
bdexStreamOut Write this date to the specified output stream.
day Return the day of the month in the range [1 .. 31] of this date.
dayOfWeek Return the day of the week in the range [DayOfWeek::e_SUN .. DayOfWeek::e_SAT] of this date.
dayOfYear Return the day of the year in the range [1 .. 366] of this date.
getYearDay Load, into the specified year and dayOfYear, the respective year and dayOfYear attribute values of this date.
getYearMonthDay Load, into the specified year, month, and day, the respective year, month, and day attribute values of this date.
month Return the month of the year in the range [1 .. 12] of this date.
monthOfYear Return the month of the year in the range [MonthOfYear::e_JAN .. MonthOfYear::e_DEC] of this date.
operator++ Advance this date by one day.
operator+= Advance this date by the specified (signed) number of days.
operator-- Move this date earlier by one day.
operator-= Move this date earlier by the specified (signed) number of days.
print Write this date to the specified output stream in a human-readable form.
setYearDay Set this date to the specified year and dayOfYear.
setYearDayIfValid Set this date from year and dayOfYear if they form a valid value.
setYearMonthDay Set this date to the specified year, month, and day.
setYearMonthDayIfValid Set this date from Y/M/D if they form a valid value; otherwise do nothing.
streamOut Write this date to the specified stream in a single-line format.
validateAndSetYearDay Set this date from year and dayOfYear if they form a valid value.
validateAndSetYearMonthDay Set this date from Y/M/D if they form a valid value; otherwise do nothing.
year Return the year in the range [1 .. 9999] of this date.

Static Member Functions

NameDescription
isValid isValid overloads
isValidYearDay Return true if year and dayOfYear form a valid Date value.
isValidYearMonthDay Return true if year, month, and day form a valid Date value.
maxSupportedBdexVersion maxSupportedBdexVersion overloads
maxSupportedVersion Return the most current BDEX streaming version number supported by this class.

Friends

NameDescription
BloombergLP::bdlt::hashAppendInvoke hashAlg on the specified Date object.
BloombergLP::bdlt::operator-Return the signed number of days between two dates.
BloombergLP::bdlt::operator-Return the date that is earlier by numDays from the specified date.
BloombergLP::bdlt::operator+Return the date that is later by numDays from the specified date.
BloombergLP::bdlt::operator+Return the date that is later by numDays from the specified date.
BloombergLP::bdlt::operator>Return true if the specified lhs date is later than the specified rhs date, and false otherwise.
BloombergLP::bdlt::operator>=Return true if the specified lhs date is later than or the same as the specified rhs date, and false otherwise.
BloombergLP::bdlt::operator<=Return true if the specified lhs date is earlier than or the same as the specified rhs date, and false otherwise.
BloombergLP::bdlt::operator<Return true if the specified lhs date is earlier than the specified rhs date, and false otherwise.
BloombergLP::bdlt::operator!=Return true if the two dates do not have the same value.
BloombergLP::bdlt::operator==Return true if the two dates have the same value.

Non-Member Functions

NameDescription
operator++Advance date by one day and return its previous value.
operator--Move date earlier by one day and return its previous value.

Derived Classes

NameDescription
PackedCalendar_DateRef Reference to a Date for holiday and business-day iterators.