![]() |
Vault
4.1
|
VDate represents a calendar date: a year/month/day. More...
#include <vinstant.h>
Public Types | |
enum | { kYMD, kYDM, kMYD, kMDY, kDYM, kDMY } |
enum | { kSunday = 0, kMonday, kTuesday, kWednesday, kThursday, kFriday, kSaturday } |
Public Member Functions | |
VDate () | |
Constructs a date with values set to 0000-01-01 (useless but legal state for a VDate object). | |
VDate (const VString &timeZoneID) | |
Constructs a date from the current instant. | |
VDate (int year, int month, int day) | |
Constructs a date from specified values. | |
virtual | ~VDate () |
Destructor. | |
int | getYear () const |
Returns the year of the date. | |
int | getMonth () const |
Returns the month of the date. | |
int | getDay () const |
Returns the day of the month of the date. | |
int | getDayOfWeek () const |
Returns the day of the week of the date. | |
void | set (int year, int month, int day) |
Sets the date from specified values. | |
void | setYear (int year) |
Sets the year of the date. | |
void | setMonth (int month) |
Sets the month of the date. | |
void | setDay (int day) |
Sets the day of the month. | |
Static Public Member Functions | |
static VDate | createFromDateString (const VString &dateString, const VCodePoint &delimiter) |
static const VCodePoint & | getLocalDateSeparator () |
Returns the date separator for the locale. | |
static int | getLocalDateOrder () |
Returns the date string element order for the locale. | |
Friends | |
bool | operator== (const VDate &lhs, const VDate &rhs) |
Compares two dates. | |
bool | operator!= (const VDate &lhs, const VDate &rhs) |
Compares two dates. | |
bool | operator< (const VDate &lhs, const VDate &rhs) |
Compares two dates. | |
bool | operator<= (const VDate &lhs, const VDate &rhs) |
Compares two dates. | |
bool | operator>= (const VDate &lhs, const VDate &rhs) |
Compares two dates. | |
bool | operator> (const VDate &lhs, const VDate &rhs) |
Compares two dates. |
VDate represents a calendar date: a year/month/day.
Per (*) below, the "day" field is actually allowed to be in the range 1 to 32, for purposes of allowing the caller to increment the day and then convert to a VInstant.
Definition at line 956 of file vinstant.h.
anonymous enum |
kYMD |
Year/Month/Day. |
kYDM |
Year/Day/Month. |
kMYD |
Month/Year/Day. |
kMDY |
Year/Day/Month. |
kDYM |
Day/Year/Month. |
kDMY |
Day/Month/Year. |
Definition at line 1040 of file vinstant.h.
VDate::VDate | ( | ) |
Constructs a date with values set to 0000-01-01 (useless but legal state for a VDate object).
Your first use of such a date object should be to assign it a useful value.
Definition at line 1071 of file vinstant.cpp.
References ASSERT_INVARIANT.
VDate::VDate | ( | const VString & | timeZoneID | ) |
Constructs a date from the current instant.
Throws an exception if you specify RTZ conversion and there is no converter installed.
timeZoneID | specifies which time zone the y/m/d should be given in |
Definition at line 1079 of file vinstant.cpp.
References ASSERT_INVARIANT, VInstant::getDate(), getDay(), getMonth(), and getYear().
VDate::VDate | ( | int | year, |
int | month, | ||
int | day | ||
) |
Constructs a date from specified values.
year | the year |
month | the month (1 to 12) |
day | the day of the month (1 to 31*) |
Definition at line 1093 of file vinstant.cpp.
References ASSERT_INVARIANT.
int VDate::getYear | ( | ) | const |
Returns the year of the date.
Definition at line 1105 of file vinstant.cpp.
References ASSERT_INVARIANT.
int VDate::getMonth | ( | ) | const |
Returns the month of the date.
Definition at line 1111 of file vinstant.cpp.
References ASSERT_INVARIANT.
int VDate::getDay | ( | ) | const |
Returns the day of the month of the date.
Definition at line 1117 of file vinstant.cpp.
References ASSERT_INVARIANT.
int VDate::getDayOfWeek | ( | ) | const |
Returns the day of the week of the date.
Definition at line 1123 of file vinstant.cpp.
References ASSERT_INVARIANT, VInstantStruct::getOffsetFromUTCStruct(), VInstantStruct::mDay, VInstantStruct::mDayOfWeek, VInstantStruct::mHour, VInstantStruct::mMillisecond, VInstantStruct::mMinute, VInstantStruct::mMonth, VInstantStruct::mSecond, VInstantStruct::mYear, and VInstantStruct::setUTCStructFromOffset().
void VDate::set | ( | int | year, |
int | month, | ||
int | day | ||
) |
Sets the date from specified values.
year | the year |
month | the month of the year (1 to 12) |
day | the day of the month (1 to 31*) |
Definition at line 1145 of file vinstant.cpp.
References ASSERT_INVARIANT.
void VDate::setYear | ( | int | year | ) |
Sets the year of the date.
year | the year |
Definition at line 1159 of file vinstant.cpp.
References ASSERT_INVARIANT.
void VDate::setMonth | ( | int | month | ) |
Sets the month of the date.
month | the month of the year (1 to 12) |
Definition at line 1167 of file vinstant.cpp.
References ASSERT_INVARIANT.
void VDate::setDay | ( | int | day | ) |
Sets the day of the month.
day | the day of the month (1 to 31*) |
Definition at line 1175 of file vinstant.cpp.
References ASSERT_INVARIANT.
static const VCodePoint& VDate::getLocalDateSeparator | ( | ) | [inline, static] |
Returns the date separator for the locale.
(Currently just returns a slash.)
Definition at line 1038 of file vinstant.h.
static int VDate::getLocalDateOrder | ( | ) | [inline, static] |
Returns the date string element order for the locale.
(Currently just returns a kMDY.)
Definition at line 1054 of file vinstant.h.
References kMDY.