A class for manipulating dates.
wxDate::wxDate
wxDate::~wxDate
wxDate::AddMonths
wxDate::AddWeeks
wxDate::AddYears
wxDate::FormatDate
wxDate::GetDay
wxDate::GetDayOfWeek
wxDate::GetDayOfWeekName
wxDate::GetDayOfYear
wxDate::GetDaysInMonth
wxDate::GetFirstDayOfMonth
wxDate::GetJulianDate
wxDate::GetMonth
wxDate::GetMonthEnd
wxDate::GetMonthName
wxDate::GetMonthStart
wxDate::GetWeekOfMonth
wxDate::GetWeekOfYear
wxDate::GetYear
wxDate::GetYearEnd
wxDate::GetYearStart
wxDate::IsLeapYear
wxDate::Set
wxDate::SetFormat
wxDate::SetOption
wxDate::operator char *
wxDate::operator +
wxDate::operator -
wxDate::operator +=
wxDate::operator -=
wxDate::operator ++
wxDate::operator --
wxDate::operator <
wxDate::operator <=
wxDate::operator >
wxDate::operator >=
wxDate::operator ==
wxDate::operator !=
wxDate::operator <<
void wxDate(void)
Default constructor.
void wxDate(wxDate& date)
Copy constructor.
void wxDate(const int month, const int day, const int year)
Constructor.
month is a number from 1 to 12.
day is a number from 1 to 31.
year is a year, such as 1995, 2005.
void wxDate(const long julian)
Constructor taking an integer representing the Julian date. This is the number of days since 1st January 4713 B.C., so to convert from the number of days since 1st January 1901, construct a date for 1/1/1901, and add the number of days.
void wxDate(const char *date)
Constructor taking a string representing a date. This must be either the string TODAY, or of the form MM/DD/YYYY or MM-DD-YYYY. For example:
wxDate date("11/26/1966");
void ~wxDate(void)
Destructor.
wxDate& AddMonths(int months=1)
Adds the given number of months to the date, returning a reference to 'this'.
wxDate& AddWeeks(int weeks=1)
Adds the given number of weeks to the date, returning a reference to 'this'.
wxDate& AddYears(int years=1)
Adds the given number of months to the date, returning a reference to 'this'.
char * FormatDate(const int type=-1) const
Formats the date according to type if not -1, or according to the current display type if -1.
type can be -1 or one of:
wxDAY | Format day only. |
wxMONTH | Format month only. |
wxMDY | Format MONTH, DAY, YEAR. |
wxFULL | Format day, month and year in US style: DAYOFWEEK, MONTH, DAY, YEAR. |
wxEUROPEAN | Format day, month and year in European style: DAY, MONTH, YEAR. |
The return value is a pointer to a statically-allocated character string.
int GetDay(void) const
Returns the numeric day (in the range 1 to 31).
int GetDayOfWeek(void) const
Returns the integer day of the week (in the range 1 to 7).
char * GetDayOfWeekName(void)
Returns the name of the day of week. Do not delete the storage returned.
long GetDayOfYear(void) const
Returns the day of the year (from 1 to 365).
int GetDaysInMonth(void) const
Returns the number of days in the month (in the range 1 to 31).
int GetFirstDayOfMonth(void) const
Returns the day of week that is first in the month (in the range 1 to 7).
long GetJulianDate(void) const
Returns the Julian date.
int GetMonth(void) const
Returns the month number (in the range 1 to 12).
wxDate GetMonthEnd(void)
Returns the date representing the last day of the month.
char * GetMonthName(void)
Returns the name of the month. Do not delete the returned storage.
wxDate GetMonthStart(void)
Returns the date representing the first day of the month.
int GetWeekOfMonth(void)
Returns the week of month (in the range 1 to 6).
int GetWeekOfYear(void)
Returns the week of year (in the range 1 to 52).
int GetYear(void) const
Returns the year as an integer (such as '1995').
wxDate GetYearEnd(void)
Returns the date representing the last day of the year.
wxDate GetYearStart(void)
Returns the date representing the first day of the year.
Bool IsLeapYear(void) const
Returns TRUE if the year of this date is a leap year.
wxDate& Set(void)
Sets the date to current system date, returning a reference to 'this'.
wxDate& Set(long julian)
Sets the date to the given Julian date, returning a reference to 'this'.
wxDate& Set(int month, int day, int year)
Sets the date to the given date, returning a reference to 'this'.
month is a number from 1 to 12.
day is a number from 1 to 31.
year is a year, such as 1995, 2005.
void SetFormat(const int format)
Sets the current format type.
format can be -1 or one of:
wxDAY | Format day only. |
wxMONTH | Format month only. |
wxMDY | Format MONTH, DAY, YEAR. |
wxFULL | Format day, month and year in US style: DAYOFWEEK, MONTH, DAY, YEAR. |
wxEUROPEAN | Format day, month and year in European style: DAY, MONTH, YEAR. |
int SetOption(const int option, const Bool enable=TRUE)
Enables or disables an option for formatting. option may be one of:
wxNO_CENTURY | The century is not formatted. |
wxDATE_ABBR | Month and day names are abbreviated to 3 characters when formatting. |
operator char *(void)
Conversion operator, to convert wxDate to char * by calling FormatDate.
wxDate operator +(const long i)
wxDate operator +(const int i)
Adds an integer number of days to the date, returning a date.
wxDate operator -(const long i)
wxDate operator -(const int i)
Subtracts an integer number of days from the date, returning a date.
long operator -(const wxDate& date)
Subtracts one date from another, return the number of intervening days.
wxDate& operator +=(const long i)
Postfix operator: adds an integer number of days to the date, returning a reference to 'this' date.
wxDate& operator -=(const long i)
Postfix operator: subtracts an integer number of days from the date, returning a reference to 'this' date.
wxDate& operator ++(void)
Increments the date (postfix or prefix).
wxDate& operator --(void)
Decrements the date (postfix or prefix).
friend Bool operator <(const wxDate& date1, const wxDate& date2)
Function to compare two dates, returning TRUE if date1 is earlier than date2.
friend Bool operator <=(const wxDate& date1, const wxDate& date2)
Function to compare two dates, returning TRUE if date1 is earlier than or equal to date2.
friend Bool operator >(const wxDate& date1, const wxDate& date2)
Function to compare two dates, returning TRUE if date1 is later than date2.
friend Bool operator >=(const wxDate& date1, const wxDate& date2)
Function to compare two dates, returning TRUE if date1 is later than or equal to date2.
friend Bool operator ==(const wxDate& date1, const wxDate& date2)
Function to compare two dates, returning TRUE if date1 is equal to date2.
friend Bool operator !=(const wxDate& date1, const wxDate& date2)
Function to compare two dates, returning TRUE if date1 is not equal to date2.
friend ostream& operator <<(ostream& os, const wxDate& date)
Function to output a wxDate to an ostream.