libcommonc++
0.7
|
A representation of a calendar date and clock time. More...
#include <DateTime.h++>
Public Types | |
enum | Weekday { Invalid = 0, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday } |
Public Member Functions | |
DateTime (time_s_t time) | |
Construct a DateTime for the given system time. More... | |
DateTime (time_ms_t time=0) | |
Construct a DateTime for the given time (or the current time). More... | |
DateTime (uint_t day, uint_t month, uint_t year, uint_t hour=0, uint_t minute=0, uint_t second=0, uint_t msec=0) | |
Construct a DateTime with the given components. More... | |
DateTime (const Date &date, const Time &time) | |
Construct a DateTime from the given Date and Time. More... | |
DateTime (const Date &date) | |
Construct a DateTime for the given Date. More... | |
DateTime (const Time &time) | |
Construct a DateTime for the given Time. More... | |
DateTime (const DateTime &other) | |
Copy constructor. More... | |
virtual | ~DateTime () |
Destructor. More... | |
DateTime & | normalize () |
Normalize the DateTime. More... | |
operator time_s_t () const | |
Cast operator. More... | |
operator time_ms_t () const | |
Cast operator. More... | |
bool | operator== (const DateTime &other) const |
bool | operator< (const DateTime &other) const |
bool | operator<= (const DateTime &other) const |
bool | operator!= (const DateTime &other) const |
bool | operator> (const DateTime &other) const |
bool | operator>= (const DateTime &other) const |
DateTime & | operator= (time_s_t other) |
DateTime & | operator= (time_ms_t other) |
DateTime & | operator= (const DateTime &other) |
void | setTime (uint_t hour, uint_t minute, uint_t second=0, uint_t msec=0) |
Set the hour, minute, second, and millisecond components of the time. More... | |
void | setDate (uint_t day, uint_t month, uint_t year) |
Set the day, month, and year components of the date. More... | |
DateTime & | setDate (const Date &other) |
Set the date portion of the DateTime. More... | |
DateTime & | setTime (const Time &other) |
Set the time portion of the DateTime. More... | |
DateTime & | operator+= (const TimeSpan &span) |
Add a TimeSpan to this DateTime. More... | |
DateTime & | operator-= (const TimeSpan &span) |
Subtract a TimeSpan from this DateTime. More... | |
void | setMonth (uint_t month) |
Set the month component of the date. More... | |
void | setDay (uint_t day) |
Set the day-of-month component of the date. More... | |
void | setYear (uint_t year) |
Set the year component of the date. More... | |
uint_t | getMonth () const |
Get the month component of the date. More... | |
uint_t | getDay () const |
Get the day-of-month component of the date. More... | |
uint_t | getYear () const |
Get the year component of the date. More... | |
Weekday | getWeekday () const |
Get the weekday of the date. More... | |
uint_t | getDayOfYear () const |
Get the day of the year. More... | |
uint_t | getWeekOfYear () const |
Get the week number of the year, where weeks are defined as beginning on Monday (ISO standard). More... | |
bool | isValid () const |
Test if the date is valid. More... | |
bool | operator== (const Date &other) const |
bool | operator< (const Date &other) const |
bool | operator<= (const Date &other) const |
bool | operator!= (const Date &other) const |
bool | operator> (const Date &other) const |
bool | operator>= (const Date &other) const |
void | setHour (uint_t hour) |
Set the hour component of the time. More... | |
void | setHour12 (uint_t hour, bool pm=false) |
Set the hour component of the time (12-hour clock). More... | |
void | setMinute (uint_t minute) |
Set the minute component of the time. More... | |
void | setSecond (uint_t second) |
Set the second component of the time. More... | |
void | setMillisecond (uint_t msec) |
Set the millisecond component of the time. More... | |
uint_t | getHour () const |
Get the hour component of the time. More... | |
uint_t | getHour12 () const |
Get the hour component of the time (12-hour clock). More... | |
bool | isPM () const |
Test if the hour is post meridiem. More... | |
bool | isAM () const |
Test if the hour is ante meridiem. More... | |
uint_t | getMinute () const |
Get the minute component of the time. More... | |
uint_t | getSecond () const |
Get the second component of the time. More... | |
uint_t | getMillisecond () const |
Get the millisecond component of the time. More... | |
bool | operator== (const Time &other) const |
bool | operator< (const Time &other) const |
bool | operator<= (const Time &other) const |
bool | operator!= (const Time &other) const |
bool | operator> (const Time &other) const |
bool | operator>= (const Time &other) const |
Static Public Member Functions | |
static bool | isDSTActive () |
Test if Daylight Saving Time is in effect for the current local time. More... | |
static int | getGMTOffset () |
Get the offset, in seconds, between local time and GMT. More... | |
static String | getTimeZone () |
Get the name of the local time zone. More... | |
static bool | isLeapYear (uint_t year) |
Test if a year is a leap year. More... | |
Static Public Attributes | |
static const uint_t | JAN = 1 |
The month of January. More... | |
static const uint_t | FEB = 2 |
The month of February. More... | |
static const uint_t | MAR = 3 |
The month of March. More... | |
static const uint_t | APR = 4 |
The month of April. More... | |
static const uint_t | MAY = 5 |
The month of May. More... | |
static const uint_t | JUN = 6 |
The month of June. More... | |
static const uint_t | JUL = 7 |
The month of July. More... | |
static const uint_t | AUG = 8 |
The month of August. More... | |
static const uint_t | SEP = 9 |
The month of September. More... | |
static const uint_t | OCT = 10 |
The month of October. More... | |
static const uint_t | NOV = 11 |
The month of November. More... | |
static const uint_t | DEC = 12 |
The month of December. More... | |
A representation of a calendar date and clock time.
|
inherited |
DateTime | ( | uint_t | day, |
uint_t | month, | ||
uint_t | year, | ||
uint_t | hour = 0 , |
||
uint_t | minute = 0 , |
||
uint_t | second = 0 , |
||
uint_t | msec = 0 |
||
) |
Construct a DateTime with the given components.
|
virtual |
Destructor.
|
inlineinherited |
Get the day-of-month component of the date.
|
inherited |
Get the day of the year.
|
static |
Get the offset, in seconds, between local time and GMT.
|
inlineinherited |
Get the hour component of the time.
|
inlineinherited |
Get the hour component of the time (12-hour clock).
|
inlineinherited |
Get the millisecond component of the time.
|
inlineinherited |
Get the minute component of the time.
|
inlineinherited |
Get the month component of the date.
|
inlineinherited |
Get the second component of the time.
|
static |
Get the name of the local time zone.
|
inherited |
Get the weekday of the date.
|
inherited |
Get the week number of the year, where weeks are defined as beginning on Monday (ISO standard).
|
inlineinherited |
Get the year component of the date.
|
inlineinherited |
Test if the hour is ante meridiem.
|
static |
Test if Daylight Saving Time is in effect for the current local time.
|
staticinherited |
Test if a year is a leap year.
|
inlineinherited |
Test if the hour is post meridiem.
|
inherited |
Test if the date is valid.
DateTime & normalize | ( | ) |
Normalize the DateTime.
This method converts invalid dates into valid dates. For example, a date of "February 31, 2000" is normalized to "March 2, 2000".
operator time_ms_t | ( | ) | const |
Cast operator.
operator time_s_t | ( | ) | const |
Cast operator.
|
inline |
|
inlineinherited |
|
inlineinherited |
bool operator< | ( | const DateTime & | other | ) | const |
|
inherited |
|
inherited |
bool operator<= | ( | const DateTime & | other | ) | const |
|
inherited |
|
inherited |
bool operator== | ( | const DateTime & | other | ) | const |
|
inherited |
|
inherited |
|
inline |
|
inlineinherited |
|
inlineinherited |
|
inline |
|
inlineinherited |
|
inlineinherited |
Set the day, month, and year components of the date.
|
inherited |
Set the day-of-month component of the date.
|
inherited |
Set the hour component of the time.
|
inherited |
Set the hour component of the time (12-hour clock).
|
inherited |
Set the millisecond component of the time.
|
inherited |
Set the minute component of the time.
|
inherited |
Set the month component of the date.
|
inherited |
Set the second component of the time.
Set the hour, minute, second, and millisecond components of the time.
|
inherited |
Set the year component of the date.
|
staticinherited |
The month of April.
|
staticinherited |
The month of August.
|
staticinherited |
The month of December.
|
staticinherited |
The month of February.
|
staticinherited |
The month of January.
|
staticinherited |
The month of July.
|
staticinherited |
The month of June.
|
staticinherited |
The month of March.
|
staticinherited |
The month of May.
|
staticinherited |
The month of November.
|
staticinherited |
The month of October.
|
staticinherited |
The month of September.