This class is used to represent a point in time.
|
Public Types |
| enum | { ONEDAY = 24 * 60 * 60 * 1000,
ONEHOUR = 60*60*1000,
ONEMINUTE = 60*1000,
ONESECOND = 1000
} |
| enum | Months {
Jan = 1,
Feb,
Mar,
Apr,
May,
Jun,
Jul,
Aug,
Sep,
Oct,
Nov,
Dec
} |
| enum | WeekDay {
Sun = 0,
Mon,
Tue,
Wed,
Thu,
Fri,
Sat
} |
| enum | DayTime { AM = 0,
PM
} |
Public Member Functions |
| | DateTime () |
| | Constructs a blank/empty date time object.
|
| | DateTime (time_t newTime) |
| | Constructs a date time object from a C time time_t value.
|
| | DateTime (uint32 year, uint32 month, uint32 day) |
| | Constructs a date time object given a year, month, and a day.
|
| | DateTime (uint32 year, uint32 month, uint32 day, uint32 hour, uint32 minute, uint32 second) |
| | Constructs a date time object given a year, month, day, hour, minute, and second.
|
| uint64 | getMilliseconds () const |
| | Returns a 64 bit unsigned integer that contains the total number of milliseconds in this object.
|
| void | setMilliseconds (const uint64 &milliseconds) |
| | Sets the total number of milliseconds.
|
| void | set (const uint32 &year, const uint32 &month, const uint32 &day, const uint32 &hour=0, const uint32 &minutes=0, const uint32 &seconds=0, const uint32 &milliseconds=0) |
| | Allows you to modify the date/time of this object.
|
| void | setDate (const uint32 &year, const uint32 &month, const uint32 &day) |
| | Setting the date causes the current time to reset to 0:0:0.
|
| void | setTime (const uint32 &hour, const uint32 &minutes, const uint32 &seconds) |
| | Setting the time via this function keeps the current date.
|
| void | get (uint32 *year, uint32 *month, uint32 *day, uint32 *hour, uint32 *minute, uint32 *second, uint32 *millsecond=NULL) const |
| | Gets all the components of date/time.
|
| void | getDate (uint32 *year, uint32 *month, uint32 *day) const |
| | Gets all the components of the date.
|
| void | getTime (uint32 *hour, uint32 *minute, uint32 *second, uint32 *millsecond=NULL) const |
| | Gets all the components of the time.
|
| DateTime | toLocal () const |
| | Converts the time to the system's local time.
|
| DateTime | toUTC () const |
| | Converts the time to UTC time.
|
| DateTime & | operator= (const DateTime &rhs) |
| | allows for assignment between this date time object and another.
|
| | operator uint64 () const |
| | allows conversion to a uint64 ( POD ) data type
|
| DateTime & | operator= (const time_t &rhs) |
| | Allows for assignment of C time values to this date time object.
|
| DateTime | operator+ (const DateTimeSpan &rhs) const |
| | Allows you to add a time span to the value of this date object and return the new date object.
|
| DateTime | operator- (const DateTimeSpan &rhs) const |
| | Allows you to subtract a time span from the value of this date object and return the new date object.
|
| DateTimeSpan | operator- (const DateTime &rhs) const |
| | Allows you to subtract one date time object from another and returns the date time span between them.
|
| bool | operator> (const DateTime &rhs) const |
| bool | operator>= (const DateTime &rhs) const |
| bool | operator< (const DateTime &rhs) const |
| bool | operator<= (const DateTime &rhs) const |
| bool | operator== (const DateTime &rhs) const |
| bool | operator!= (const DateTime &rhs) const |
| DayTime | getDayTime () const |
| bool | isAM () const |
| | Is the current time in the AM or not.
|
| bool | isPM () const |
| | Is the current time in the PM or not.
|
| bool | firstDayOfTheWeek () const |
| bool | lastDayOfTheWeek () const |
| bool | firstDayOfTheMonth () const |
| bool | lastDayOfTheMonth () const |
| bool | firstDayOfTheYear () const |
| bool | lastDayOfTheYear () const |
| bool | isLeapYear () const |
| time_t | getCTime () const |
| uint32 | getYear () const |
| uint32 | getMonth () const |
| uint32 | getDay () const |
| uint32 | getHour () const |
| uint32 | getMinute () const |
| uint32 | getSecond () const |
| uint32 | getMillisecond () const |
| WeekDay | getWeekDay () const |
| uint32 | getDayOfYear () const |
| uint32 | getDaysInYear () const |
| uint32 | getNumberOfDaysInMonth () const |
| uint32 | getWeekOfYearStartingSun () const |
| uint32 | getWeekOfYearStartingMon () const |
| uint32 | getWeeksInYear () const |
| virtual String | toString () const |
| | returns a string representation of the object
|
| virtual void | loadFromStream (InputStream *stream, const MIMEType &type=MIMEType()) |
| | Read the object from the specified input stream.
|
| virtual void | saveToStream (OutputStream *stream, const MIMEType &type=MIMEType()) |
| | Write the object to the specified output stream.
|
| DateTime & | incrYear (const uint32 &by=1) |
| | increments the year of this date object.
|
| DateTime & | incrMonth (const uint32 &by=1) |
| | increments the month of this date object.
|
| DateTime & | incrDay (const uint32 &by=1) |
| | increments the day of this date object.
|
| DateTime & | incrHour (const uint32 &by=1) |
| | increments the hour of this date object.
|
| DateTime & | incrMinute (const uint32 &by=1) |
| | increments the minute of this date object.
|
| DateTime & | incrSecond (const uint32 &by=1) |
| | increments the second of this date object.
|
| DateTime & | incrMilliSecond (const uint32 &by=1) |
| | increments the millisecond of this date object.
|
| DateTime & | decrYear (const uint32 &by=1) |
| | decrements the year of this date object
|
| DateTime & | decrMonth (const uint32 &by=1) |
| | decrements the month of this date object.
|
| DateTime & | decrDay (const uint32 &by=1) |
| | decrements the day of this date object
|
| DateTime & | decrHour (const uint32 &by=1) |
| | decrements the hour of this date object
|
| DateTime & | decrMinute (const uint32 &by=1) |
| | decrements the minute of this date object
|
| DateTime & | decrSecond (const uint32 &by=1) |
| | decrements the second of this date object
|
| DateTime & | decrMilliSecond (const uint32 &by=1) |
| | decrements the millisecond of this date object
|
Static Public Member Functions |
| static DateTime | now () |
| | Static utility function to get the current local date on the computer the framework is running on.
|
| static void | getYearMonthDay (const DateTime &dt, uint32 *year, uint32 *month, uint32 *day) |
| static void | getHourMinuteSecond (const DateTime &dt, uint32 *hour, uint32 *minute, uint32 *second, uint32 *millsecond=NULL) |
| static uint32 | getNumberOfDaysInMonth (uint32 year, Months month) |
| static bool | isGregorianCalendarDate (const uint32 &year, const uint32 &month, const uint32 &day) |
| static bool | isGregorianCalendarDate (const DateTime &dt) |
| static bool | isLeapYear (uint32 year) |
Protected Member Functions |
| void | setAndAdjustForGregorianDay (const uint32 &year, const uint32 &month, const uint32 &day, const uint32 &hour, const uint32 &minutes, const uint32 &seconds, const uint32 &milliseconds) |
Static Protected Member Functions |
| static void | setCurrent (DateTime &dt) |
Protected Attributes |
| uint64 | time_ |
| | time is stored as the number of milliseconds since 1 January 4713 BC.
|
Friends |
| class | DateTimeSpan |
Classes |
| class | Iterator |
| | templatized class for iterating a date, either forward or backard in time, where the template type DateLogic is a class with the following static methods: More...
|
This class is used to represent a point in time.
The internal structure is a 64bit unsigned integer that counts the number of milliseconds from ~ 4700BC. The calendar used is the Gregorian calendar. There is logic to support switching to the Julian calendar for days before the Gregorian switch. At the moment there is no time zone support. This will be coming next.
There are a wide number of functions for retrieving all sorts of handy date/time info, such as :
Since the iterator template type is customizable, you can create your own iteration logic classes to perform custom iteration logic.
You can modify the date time object in a variety of ways, by specifying the year, month, day, or set the time specifying hour, minute, second, or have more control by setting all fields (year, month, day, hour, minute, second, millisecond).