|
String conversions |
CP_String | Format (FormatStyle inDateFormat=DefaultDateFormat, FormatStyle inTimeFormat=DefaultTimeFormat, const CP_TimeZone *inTimeZone=NULL) const |
| Format a date.
|
CP_String | Format (const CP_String &inFormatString, const CP_TimeZone *inTimeZone=NULL) const |
| Format a date.
|
static CP_DateTime | FromString (const CP_String &inDateString, FormatStyle inDateFormat, FormatStyle inTimeFormat, const CP_TimeZone *inTimeZone=NULL) |
| Parse a date/time string.
|
static CP_DateTime | FromStringGivenFormat (const CP_String &inDateString, const CP_String &inFormatString, const CP_TimeZone *inTimeZone=NULL) |
| Parse a date/time string.
|
Public Types |
enum | FormatStyle {
Format_none = 0,
Format_short,
Format_medium,
Format_long,
Format_full,
Format_ISO,
DefaultDateFormat = Format_medium,
DefaultTimeFormat = Format_medium
} |
| Formatting styles for date & time. More...
|
enum | enum_MacOSTime { MacOSTime
} |
Public Member Functions |
| DateTime () |
| DateTime (const CP_GregorianDate &inGregorianDate, const CP_TimeZone *inTimeZone=NULL) |
| DateTime (const CP_DateTime &inDateTime) |
| DateTime (const CP_Date &inDate, const CP_Time &inTime) |
| DateTime (const CP_Date &inDate) |
| DateTime (const CP_Time &inTime) |
| DateTime (const DateTime &inSrc) |
| DateTime (CFDateRef inDateRef, bool inRetain=true) |
virtual | ~DateTime () throw () |
virtual NodeType_t | NodeType () const throw () |
virtual void | PrintToLog (CP_LogFile &inLogFile, SInt32 inLevel=0, SInt32 inIndentLevel=0) const |
virtual CFTypeRef | GetNodeCFRef () const |
virtual void | WriteXMLData (CP_OutStream &inXMLDataStream) const |
|
UInt32 | GetJulian (const CP_TimeZone *inTimeZone=NULL) const |
| Returns the date/time in Julian format in the specified time zone.
|
CP_GregorianDate | GetGregorianDate (const CP_TimeZone *inTimeZone=NULL) const |
| Returns the Gregorian representation of the date/time in the specified time zone.
|
UInt16 | GetYear (const CP_TimeZone *inTimeZone=NULL) const |
| Returns the year of the date/time in the specified time zone.
|
UInt8 | GetMonth (const CP_TimeZone *inTimeZone=NULL) const |
| Returns the month of the date/time in the specified time zone.
|
UInt8 | GetDay (const CP_TimeZone *inTimeZone=NULL) const |
| Returns the day of the date/time in the specified time zone.
|
UInt8 | GetDayOfWeek (const CP_TimeZone *inTimeZone=NULL) const |
| Returns the day of the week this date falls on in the specified time zone.
|
UInt16 | GetDayOfYear (const CP_TimeZone *inTimeZone=NULL) const |
| Returns the day of the year this date falls on in the specified time zone.
|
UInt8 | GetDayOfWeekInMonth (const CP_TimeZone *inTimeZone=NULL) const |
| Returns the day of week in month (e.g. 2 means 2nd Wed in July).
|
UInt8 | GetWeekInYear (const CP_TimeZone *inTimeZone=NULL) const |
| Returns the week of year ( 1 to 52(53) ) this date falls in the specified time zone.
|
UInt8 | GetWeekInMonth (const CP_TimeZone *inTimeZone=NULL) const |
| Returns the week of month (1 to 5) this date falls in the specified time zone.
|
CP_String | GetMonthString (bool inShortVersion=false, const CP_TimeZone *inTimeZone=NULL) const |
| Returns the name of the month this date falls on in the specified time zone.
|
UInt8 | GetHour (const CP_TimeZone *inTimeZone=NULL) const |
| Returns the hour portion of the date/time in the specified time zone.
|
SInt16 | GetMinute (const CP_TimeZone *inTimeZone=NULL) const |
| Returns the minute portion of the date/time in the specified time zone.
|
UInt8 | GetSecond (const CP_TimeZone *inTimeZone=NULL) const |
| Returns the seconds portion of the date/time in the specified time zone.
|
UInt16 | GetMillisecond (const CP_TimeZone *inTimeZone=NULL) const |
| Returns the milliseconds portion of the date/time in the specified time zone.
|
CP_Date | GetDate (const CP_TimeZone *inTimeZone=NULL) const |
| Returns the date portion of the date/time in the specified time zone.
|
CP_Time | GetTime (const CP_TimeZone *inTimeZone=NULL) const |
| Returns the time portion of the date/time in the specified time zone.
|
|
void | SetToNow () |
void | SetGregorianDate (const CP_GregorianDate &inGregorianDate, const CP_TimeZone *inTimeZone=NULL) |
| Sets the date/time to the specified Gregorian date in the defined timezone.
|
void | SetYear (UInt16 inYear, const CP_TimeZone *inTimeZone=NULL) |
| Sets the year of this date/time.
|
void | SetMonth (UInt8 inMonth, const CP_TimeZone *inTimeZone=NULL) |
| Sets the month of this date/time.
|
void | SetDay (UInt8 inDay, const CP_TimeZone *inTimeZone=NULL) |
| Sets the date of this date/time.
|
void | SetDayOfWeek (UInt8 inDayOfWeek, const CP_TimeZone *inTimeZone=NULL) |
| Sets the date of the week of this date/time.
|
void | SetHour (UInt8 inHour, const CP_TimeZone *inTimeZone=NULL) |
| Sets the hour of this date/time.
|
void | SetMinute (UInt8 inMinute, const CP_TimeZone *inTimeZone=NULL) |
| Sets the minute of this date/time.
|
void | SetSecond (UInt8 inSecond, const CP_TimeZone *inTimeZone=NULL) |
| Sets the second of this date/time.
|
void | SetMillisecond (UInt16 inMillisecond, const CP_TimeZone *inTimeZone=NULL) |
| Sets the hour of this date/time.
|
void | SetDate (const CP_Date &inDatePart, const CP_TimeZone *inTimeZone=NULL) |
| Sets the date portion of the date/time.
|
void | SetTime (const CP_Time &inTimePart, const CP_TimeZone *inTimeZone=NULL) |
| Sets the time portion of the date/time.
|
|
bool | operator> (const CP_DateTime &inDate) const |
| compare to another date/time
|
bool | operator< (const CP_DateTime &inDate) const |
| compare to another date/time
|
bool | operator>= (const CP_DateTime &inDate) const |
| compare to another date/time
|
bool | operator<= (const CP_DateTime &inDate) const |
| compare to another date/time
|
bool | operator== (const CP_DateTime &inDate) const |
| compare to another date/time
|
bool | operator!= (const CP_DateTime &inDate) const |
| compare to another date/time
|
bool | IsSecondsEqual (const CP_DateTime &inRhs) const |
| compare to another date/time to be equal up to the second (but ignoring millisecond differences)
|
|
void | GetLongDate (LongDateRec &outDateRec, const CP_TimeZone *inTimeZone=NULL) const |
| Get a MacOS LongDateRec of the date/time in the specified timezone.
|
UInt32 | GetMacSeconds (const CP_TimeZone *inTimeZone=NULL) const |
| Get a MacOS seconds value of the date/time in the specified timezone.
|
CFAbsoluteTime | GetAbsoluteTime () const |
| Get a CoreFoundation absolute time value for the date.
|
|
void | SetDate (const LongDateRec &inDateRec, const CP_TimeZone *inTimeZone=NULL) |
| Set the date/time from LongDateRec.
|
|
void | GetDate (SYSTEMTIME &inSystemTime, const CP_TimeZone *inTimeZone=NULL) const |
| Get SYSTEMTIME representation of the date/time for the given timezone.
|
FILETIME | GetAbsoluteTime () const |
| Get FILETIME absolute time value for the date/time.
|
|
void | SetDate (const SYSTEMTIME &inSystemTime, const CP_TimeZone *inTimeZone=NULL) |
| Set date/time from SYSTEMTIME representation for the given timezone.
|
void | SetAbsoluteTime (const FILETIME &theFileTime) |
|
UInt32 | GetJulian (const CP_TimeZone *inTimeZone=NULL) const |
| Returns the date/time in Julian format in the specified time zone.
|
CP_GregorianDate | GetGregorianDate (const CP_TimeZone *inTimeZone=NULL) const |
| Returns the Gregorian representation of the date/time in the specified time zone.
|
UInt16 | GetYear (const CP_TimeZone *inTimeZone=NULL) const |
| Returns the year of the date/time in the specified time zone.
|
UInt8 | GetMonth (const CP_TimeZone *inTimeZone=NULL) const |
| Returns the month of the date/time in the specified time zone.
|
UInt8 | GetDay (const CP_TimeZone *inTimeZone=NULL) const |
| Returns the day of the date/time in the specified time zone.
|
UInt8 | GetDayOfWeek (const CP_TimeZone *inTimeZone=NULL) const |
| Returns the day of the week this date falls on in the specified time zone.
|
UInt16 | GetDayOfYear (const CP_TimeZone *inTimeZone=NULL) const |
| Returns the day of the year this date falls on in the specified time zone.
|
UInt8 | GetDayOfWeekInMonth (const CP_TimeZone *inTimeZone=NULL) const |
| Returns the day of week in month (e.g. 2 means 2nd Wed in July).
|
UInt8 | GetWeekInYear (const CP_TimeZone *inTimeZone=NULL) const |
| Returns the week of year ( 1 to 52(53) ) this date falls in the specified time zone.
|
UInt8 | GetWeekInMonth (const CP_TimeZone *inTimeZone=NULL) const |
| Returns the week of month (1 to 5) this date falls in the specified time zone.
|
CP_String | GetMonthString (bool inShortVersion=false, const CP_TimeZone *inTimeZone=NULL) const |
| Returns the name of the month this date falls on in the specified time zone.
|
UInt8 | GetHour (const CP_TimeZone *inTimeZone=NULL) const |
| Returns the hour portion of the date/time in the specified time zone.
|
SInt16 | GetMinute (const CP_TimeZone *inTimeZone=NULL) const |
| Returns the minute portion of the date/time in the specified time zone.
|
UInt8 | GetSecond (const CP_TimeZone *inTimeZone=NULL) const |
| Returns the seconds portion of the date/time in the specified time zone.
|
UInt16 | GetMillisecond (const CP_TimeZone *inTimeZone=NULL) const |
| Returns the milliseconds portion of the date/time in the specified time zone.
|
CP_Date | GetDate (const CP_TimeZone *inTimeZone=NULL) const |
| Returns the date portion of the date/time in the specified time zone.
|
CP_Time | GetTime (const CP_TimeZone *inTimeZone=NULL) const |
| Returns the time portion of the date/time in the specified time zone.
|
|
void | GetDate (SYSTEMTIME &inSystemTime, const CP_TimeZone *inTimeZone=NULL) const |
| Get SYSTEMTIME representation of the date/time for the given timezone.
|
FILETIME | GetAbsoluteTime () const |
| Get FILETIME absolute time value for the date/time.
|
|
void | SetToNow () |
void | SetGregorianDate (const CP_GregorianDate &inGregorianDate, const CP_TimeZone *inTimeZone=NULL) |
| Sets the date/time to the specified Gregorian date in the defined timezone.
|
void | SetYear (UInt16 inYear, const CP_TimeZone *inTimeZone=NULL) |
| Sets the year of this date/time.
|
void | SetMonth (UInt8 inMonth, const CP_TimeZone *inTimeZone=NULL) |
| Sets the month of this date/time.
|
void | SetDay (UInt8 inDay, const CP_TimeZone *inTimeZone=NULL) |
| Sets the date of this date/time.
|
void | SetDayOfWeek (UInt8 inDayOfWeek, const CP_TimeZone *inTimeZone=NULL) |
| Sets the date of the week of this date/time.
|
void | SetHour (UInt8 inHour, const CP_TimeZone *inTimeZone=NULL) |
| Sets the hour of this date/time.
|
void | SetMinute (UInt8 inMinute, const CP_TimeZone *inTimeZone=NULL) |
| Sets the minute of this date/time.
|
void | SetSecond (UInt8 inSecond, const CP_TimeZone *inTimeZone=NULL) |
| Sets the second of this date/time.
|
void | SetMillisecond (UInt16 inMillisecond, const CP_TimeZone *inTimeZone=NULL) |
| Sets the hour of this date/time.
|
void | SetDate (const CP_Date &inDatePart, const CP_TimeZone *inTimeZone=NULL) |
| Sets the date portion of the date/time.
|
void | SetTime (const CP_Time &inTimePart, const CP_TimeZone *inTimeZone=NULL) |
| Sets the time portion of the date/time.
|
|
void | SetDate (const LongDateRec &inDateRec, const CP_TimeZone *inTimeZone=NULL) |
| Set the date/time from LongDateRec.
|
|
void | SetDate (const SYSTEMTIME &inSystemTime, const CP_TimeZone *inTimeZone=NULL) |
| Set date/time from SYSTEMTIME representation for the given timezone.
|
void | SetAbsoluteTime (const FILETIME &theFileTime) |
|
CP_DateTime | operator+ (CP_TimeInterval inTimeInterval) const |
| Adds the specified time interval to the date/time.
|
CP_DateTime & | operator+= (CP_TimeInterval inTimeInterval) |
| Adds the specified time interval to the date/time.
|
CP_DateTime | operator- (CP_TimeInterval inTimeInterval) const |
| Subtracts the specified time interval from the date/time.
|
CP_TimeInterval | operator- (const CP_DateTime &inRhs) const |
| Calculates the time interval between two date/times.
|
CP_DateTime & | operator-= (CP_TimeInterval inTimeInterval) |
| Subtracts the specified time interval from the date/time.
|
CP_DateTime & | AddGregorianUnits (const CP_GregorianUnits &inUnitsToAdd, const CP_TimeZone *inTimeZone=NULL) |
| Adds the specified number of years to the date.
|
CP_DateTime & | AddYears (SInt32 inYears, const CP_TimeZone *inTimeZone=NULL) |
| Adds the specified number of years to the date.
|
CP_DateTime & | SubtractYears (SInt32 inYears, const CP_TimeZone *inTimeZone=NULL) |
| Subtract the specified number of years from the date.
|
CP_DateTime & | AddMonths (SInt32 inMonths, const CP_TimeZone *inTimeZone=NULL) |
| Adds the specified number of months to the date.
|
CP_DateTime & | SubtractMonths (SInt32 inMonths, const CP_TimeZone *inTimeZone=NULL) |
| Subtract the specified number of months from the date.
|
CP_DateTime & | AddDays (SInt32 inDays, const CP_TimeZone *inTimeZone=NULL) |
| Adds the specified number of days to the date.
|
CP_DateTime & | SubtractDays (SInt32 inDays, const CP_TimeZone *inTimeZone=NULL) |
| Subtract the specified number of days from the date.
|
CP_DateTime & | AddHours (SInt32 inHours, const CP_TimeZone *inTimeZone=NULL) |
| Adds the specified number of hours to the date.
|
CP_DateTime & | SubtractHours (SInt32 inHours, const CP_TimeZone *inTimeZone=NULL) |
| Subtract the specified number of hours from the date.
|
CP_DateTime & | AddMinutes (SInt32 inMinutes, const CP_TimeZone *inTimeZone=NULL) |
| Adds the specified number of minutes to the date.
|
CP_DateTime & | SubtractMinutes (SInt32 inMinutes, const CP_TimeZone *inTimeZone=NULL) |
| Subtract the specified number of minutes from the date.
|
CP_DateTime & | AddSeconds (double inSeconds, const CP_TimeZone *inTimeZone=NULL) |
| Adds the specified number of seconds to the date.
|
CP_DateTime & | SubtractSeconds (double inSeconds, const CP_TimeZone *inTimeZone=NULL) |
| Subtract the specified number of seconds from the date.
|
|
bool | operator> (const CP_DateTime &inDate) const |
| compare to another date/time
|
bool | operator< (const CP_DateTime &inDate) const |
| compare to another date/time
|
bool | operator>= (const CP_DateTime &inDate) const |
| compare to another date/time
|
bool | operator<= (const CP_DateTime &inDate) const |
| compare to another date/time
|
bool | operator== (const CP_DateTime &inDate) const |
| compare to another date/time
|
bool | operator!= (const CP_DateTime &inDate) const |
| compare to another date/time
|
bool | IsSecondsEqual (const CP_DateTime &inRhs) const |
| compare to another date/time to be equal up to the second (but ignoring millisecond differences)
|
|
void | GetLongDate (LongDateRec &outDateRec, const CP_TimeZone *inTimeZone=NULL) const |
| Get a MacOS LongDateRec of the date/time in the specified timezone.
|
UInt32 | GetMacSeconds (const CP_TimeZone *inTimeZone=NULL) const |
| Get a MacOS seconds value of the date/time in the specified timezone.
|
CFAbsoluteTime | GetAbsoluteTime () const |
| Get a CoreFoundation absolute time value for the date.
|
Static Public Member Functions |
static DateTime * | FromXMLData (CP_InStream &inXMLDataStream) |
static Node * | FromXMLData (CP_InStream &inXMLDataStream, NodeType_t inExpectedNodeType=NodeType_Any) |
static Node * | CreateNodeForCFObject (CFTypeRef inObject) |
static CP_DateTime | Now () |
| Returns the current date & time.
|
Protected Attributes |
CFAbsoluteTime | fAbsoluteTime |
FILETIME | fAbsoluteTime |
Private Member Functions |
void | AttachRef (CFDateRefinRef, bool inRetain) |
CFDateRef | DetachRef () |
CFDateRef | GetCFRef () const |
bool | IsValid () const |
Private Attributes |
CFDateRef | fCFObject |