Description
The CTDateTime class represents DateTime objects.
See Also
CTDate, CTTime
Preconditions
This is one of the basic objects from the c-tree database layer.
CTDateTime Operators
- operator =: Assignment operator
- operator <, <=, >, >=, ==, !=: Comparison operators
CTDateTime.operator =
Syntax
CTDateTime& operator = (CTDATETIME DateTime)
Parameters
- DateTime [in] The CTDATETIME (double) object to be assigned to the new CTDateTime object
Description
These overloaded operators assign a CTDATETIME (double) object to a CTDateTime object
Return
The new CTDateTime object
CTDateTime.operator <, <=, >, >=, ==, !=
Syntax
bool operator < ( CTDateTime DateTime)
bool operator <= ( CTDateTime DateTime)
bool operator > ( CTDateTime DateTime)
bool operator >= ( CTDateTime DateTime)
bool operator == ( CTDateTime DateTime)
bool operator != ( CTDateTime DateTime)
Parameters
- DateTime [in] The DateTime to be compared to this CTDateTime object
Description
These overloaded operators make comparisons between the CTDateTime object and DateTime.
Return
The operators return true or false, depending on the result of the comparison.
CTDateTime Methods
Constructor / Destructor
- CTDateTime(): Creates a CTDateTime object
- ~CTDateTime(): Destroys a CTDateTime object and resets all the dependent objects
DateTime Handling
- GetDateTime(): Retrieves the DateTime
- SetDateTime(): Sets the DateTime to the CTDateTime object.
- Pack(): Packs an hour, minute and second value into a CTDATETIME type value.
- Unpack(): Unpacks a CTDATETIME type value into hour, minute and second values
- GetDate(): Retrieves a CTDate object from a CTDateTime object.
- GetTime(): Retrieves a CTTime object from a CTDateTime object.
- Year(): Retrieves the year component of a CTDATETIME object.
- Month(): Retrieves the month component of a CTDATETIME object.
- Day(): Retrieves the day component of a CTDATETIME object.
- DayOfWeek(): Retrieves the day of the week from the date part of the CTDATETIME object.
- IsLeapYear(): Indicates if the year component from a CTDATETIME object is a leap year.
- Hour(): Retrieves the hour component from a CTDATETIME type value.
- Minute(): Retrieves the minute component from a CTDATETIME type value.
- Second(): Retrieves the second component from a CTDATETIME type value.
- DateTimeToString(): Converts a packed CTDATETIME type value to a String object.
- StringToDateTime(): Converts a String object to a CTDateTime object.
- CurrentDateTime(): Retrieves the current system date and time.
- CurrentDate(): Retrieves the current system date and sets the time to zeros.
- ctdbServerDateTime(): Retrieves the current server-side date and time (V11 and later).
CTDateTime.CTDateTime
Syntax
CTDateTime( )
CTDateTime(int year, int month, int day)
CTDateTime(CTDATE Date)
CTDateTime(CTDATE Date, CTTIME Time)
CTDateTime(CTDate Date)
CTDateTime(CTDate Date, CTTime Time )
CTDateTime(CTDATETIME DateTime)
CTDateTime(CTDateTime& DateTime)
Parameters
- year [in] The year to set to the CTDate object.
- month [in] The month to set to the CTDate object.
- day [in] The day to set to the CTDate object.
- hour [in] The hour to set to the CTDateTime object.
- minute [in] The minute to set to the CTDateTime object.
- second [in] The second to set to the CTDateTime object.
- Date [in] The date to set to the CTDateTime object
- Time [in] The time to set to the CTDateTime object
- DateTime [in] The DateTime to set to the CTDateTime object
Description
This is the constructor for the CTDateTime object.
See Also
~CTDateTime()
CTDateTime.~CTDateTime
Syntax
~CTDateTime
Parameters
This destructor has no parameters.
Description
This is the destructor for the CTDateTime object.
See Also
CTDateTime()
CTDateTime.CurrentDate
Syntax
CTDateTime CurrentDate( )
Parameters
This method has no parameters.
Description
Retrieves the current system date and sets the time to zero
Return
CurrentDate() returns a CTDateTime object with the system current date.
See Also
CurrentDateTime(), GetDate()
CTDateTime.CurrentDateTime
Syntax
CTDateTime CurrentDateTime( )
Parameters
This method has no parameters.
Description
Retrieves the current system date and time
Return
CurrentDateTime() returns a CTDateTime object with the system current DateTime.
See Also
CurrentDate(), GetDateTime()
CTDateTime.DateTimeToString
Syntax
String DateTimeToString(DATE_TYPE DateType, TIME_TYPE TimeType)
Parameters
- DateType [in] The Date type format used to convert to string. The valid Date type formats are shown is "Date Types".
- TimeType [in] The Time type format used to convert to string. The valid Time type formats are shown in "Time Types".
Description
Converts a CTDateTime object to a String object.
Return
DateTimeToString() returns a String object with the DateTime.
See Also
StringToDateTime()
CTDateTime.Day
Syntax
int Day( )
Parameters
This method has no parameters.
Description
Retrieves the day component from a CTDateTime object.
Return
Day returns the unpacked day.
See Also
DayOfWeek(), Month(), Pack(), Unpack(), Year()
CTDateTime.DayOfWeek
Syntax
int DayOfWeek( )
Parameters
This method has no parameters.
Description
Retrieves the day of the week from the date part of the CTDateTime object. 0 is Sunday, 1 is Monday, ..., 6 is Saturday.
Return
DayOfWeek() returns the day of the week.
See Also
Day()
CTDateTime.GetDate
Syntax
CTDATE GetDate( )
Parameters
This method has no parameters.
Description
Retrieves a CTDate object from a CTDateTime object.
Return
GetDate() returns a CTDATE object with the date.
See Also
GetDateTime(), SetDate()
CTDateTime.GetDateTime
Syntax
CTDATETIME GetDateTime( )
Parameters
This method has no parameters.
Description
Retrieves the DateTime.
Return
GetDateTime() returns a CTDATETIME object with the DateTime.
See Also
CurrentDateTime(), SetDateTime()
CTDateTime.GetTime
Syntax
CTTime GetTime( )
Parameters
This method has no parameters.
Description
Retrieves a CTTime object from a CTDateTime object
Return
GetTime() returns a CTTime object with the time.
See Also
GetDateTime(), SetTime()
CTDateTime.IsLeapYear
Syntax
bool IsLeapYear( )
Parameters
This method has no parameters.
Description
Indicates if the year component from a CTDateTime object is a leap year.
Return
IsLeapYear() returns true if the year is a leap year and false otherwise.
See Also
Year()
CTDateTime.Hour
Syntax
int Hour( )
Parameters
This method has no parameters.
Description
Retrieves the hour component from a CTDateTime object.
Return
Hour returns the unpacked hour.
See Also
Minute(), Pack(), Second(), Unpack()
CTDateTime.Minute
Syntax
int Minute( )
Parameters
This method has no parameters.
Description
Retrieves the minute component from a CTDateTime object
Return
Minute returns the unpacked minute.
See Also
Hour(), Pack(), Second(), Unpack()
CTDateTime.Month
Syntax
int Month( )
Parameters
This method has no parameters.
Description
Retrieves the month component from a CTDateTime object
Return
Month returns the unpacked month.
See Also
Day(), Pack(), Unpack(), Year()
CTDateTime.Pack
Syntax
void Pack(int year, int month, int day, int hour, int minute, int second)
Parameters
- year [in] The year to pack.
- month [in] The month to pack.
- day [in] The day to pack.
- hour [in] The hour to pack.
- minute [in] The minute to pack.
- second [in] The second to pack.
Description
Packs an hour, minute and second value into a CTDateTime object.
Return
None.
See Also
Unpack()
CTDateTime.Second
Syntax
int Second( )
Parameters
This method has no parameters.
Description
Retrieves the second component from a CTDateTime object.
Return
Second returns the unpacked second.
See Also
Hour(), Minute(), Pack(), SecondOfWeek(), Unpack()
CTDateTime.SetDateTime
Syntax
void SetDateTime(CTDATETIME DateTime)
void SetDateTime( CTDateTime DateTime)
void SetDateTime (CTDATE Date, CTTIME Time)
void SetDateTime( CTDate Date, CTTime Time)
Parameters
- DateTime [in] The new DateTime to set to the CTDateTime object.
- Date [in] The new date to set to the CTDateTime object.
- Time [in] The new time to set to the CTDateTime object.
Description
Sets the DateTime to the CTDateTime object.
Return
None.
See Also
GetDateTime()
CTDateTime.StringToDateTime
Syntax
void StringToDateTime( String str, DATE_TYPE DateType, TIME_TYPE TimeType)
Parameters
- str [in] The string object to be converted.
- DateType [in] The Date type format used to convert to string. The valid Date type formats are shown is "Date Types".
- TimeType [in] The Time type format used to convert to string. The valid Time type formats are shown in "Time Types".
Description
Converts a String object to a CTDateTime object.
Return
None.
See Also
DateTimeToString()
CTDateTime.Unpack
Syntax
void Unpack(out int year, out int month, out int day , out int hour,
out int minute, out int second)
Parameters
- year [out] The unpacked year.
- month [out] The unpacked month.
- day [out] The unpacked day.
- hour [out] The unpacked hour.
- minute [out] The unpacked minute.
- second [out] The unpacked second.
Description
Unpacks a CTDateTime type value into hour, minute and second values
Return
None.
See Also
DayOfWeek(), Hour(), Minute(), Pack(), Second()
CTDateTime.Year
Syntax
int Year( )
Parameters
This method has no parameters.
Description
Retrieves the year component of a CTDateTime object.
Return
Year returns the unpacked year.
See Also
Day(), Month(), Pack(), Unpack()