CTDate Class

Description

The CTDate class represents Date objects.

See Also

CTDateTime, CTTime

Preconditions

This is one of the basic objects from the c-tree database layer.

CTDate Operators

  • operator = : Assignment operator
  • operator <, <=, >, >=, ==, != : Comparison operators

CTDate.operator =

Syntax

CTDate operator = ( CTDate Date)

CTDate operator = ( CTDATE Date)

Parameters

  • Date [in] The CTDate object or date to be assigned to the new CTDate object

Description

These overloaded operators assign a date or CTDate object to a CTDate object

Return

The new CTDate object

CTDate.operator <, <=, >, >=, ==, !=

Syntax

bool operator < ( CTDate Date)

bool operator <= ( CTDate Date)

bool operator > ( CTDate Date)

bool operator >= ( CTDate Date)

bool operator == ( CTDate Date)

bool operator != ( CTDate Date)

Parameters

  • Date [in] The date to be compared to this CTDate object

Description

These overloaded operators make comparisons between the CTDate object and Date.

Return

The operators return true or false, depending on the result of the comparison.

CTDate Methods

Constructor / Destructor

  • CTDate(): Creates a CTDate object
  • ~CTDate(): Destroys a CTDate object and resets all the dependent objects

Date Handling

  • GetDate(): Retrieves the date.
  • SetDate(): Sets the date to the CTDate object.
  • Pack(): Packs a year, month and day value into a CTDATE (uint) type value.
  • Unpack(): Unpacks a CTDATE (uint) type value into a year, month and day values
  • Year(): Retrieves the year component of a packed CTDATE (uint) type value
  • Month(): Retrieves the month component of a packed CTDATE (uint) type value
  • Day(): Retrieves the day component of a packed CTDATE (uint) type value
  • DayOfWeek(): Retrieves the day of the week from a packed CTDATE (uint) type value.
  • IsLeapYear(): Indicates if the year component of a packed CTDATE (uint) type value is a leap year
  • DateToString(): Converts a packed CTDATE (uint) type value to a String object
  • StringToDate(): Converts a String object to a date object
  • CurrentDate(): Retrieves the current system date.

CTDate.CTDate

Syntax

CTDate( )

CTDate(int year, int month, int day)

CTDate(uint Date)

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.
  • Date [in] The date to set to the CTDate object

Description

This is the constructor for the CTDate object.

See Also

~CTDate()

CTDate.~CTDate

Syntax

~CTDate

Parameters

This destructor has no parameters.

Description

This is the destructor for the CTDate object.

See Also

CTDate()

CTDate.CurrentDate

Syntax

CTDate CurrentDate( )

Parameters

This method has no parameters.

Description

Retrieves the current system date

Return

CurrentDate() returns a CTDate object with the system current date.

See Also

GetDate()

CTDate.DateToString

Syntax

String DateToString(DATE_TYPE DateType)

Parameters

  • DateType [in] The date type format used to convert to string. The valid date type formats are defined using the DATE_TYPE enum as shown in the following table.

The possible date formats for string conversion are:

FairCom DB API
Symbolic Constant

FairCom DB API .NET
Symbolic Constant


Description

CTDATE_MDCY

MDCY_DATE

Date is mm/dd/ccyy

CTDATE_MDY

MDY_DATE

Date is mm/dd/yy

CTDATE_DMCY

DMCY_DATE

Date is dd/mm/ccyy

CTDATE_DMY

DMY_DATE

Date is dd/mm/yy

CTDATE_CYMD

CYMD_DATE

Date is ccyymmdd

CTDATE_YMD

YMD_DATE

Date is yymmdd

Description

Converts a packed CTDATE type value to a String object.

Return

DateToString() returns a String object with the date.

See Also

StringToDate()

CTDate.Day

Syntax

int Day( )

Parameters

This method has no parameters.

Description

Retrieves the day component of a packed CTDATE type value.

Return

Day() returns the unpacked day.

See Also

DayOfWeek(), Month(), Pack(), Unpack(), Year()

CTDate.DayOfWeek

Syntax

int DayOfWeek( )

Parameters

This method has no parameters.

Description

Retrieves the day of the week from a packed CTDATE type value. 0 is Sunday, 1 is Monday, ..., 6 is Saturday.

Return

DayOfWeek() returns the day of the week.

See Also

Day()

CTDate.GetDate

Syntax

uint GetDate( )

Parameters

This method has no parameters.

Description

Retrieves the date.

Return

GetDate() returns a CTDATE object with the date.

See Also

CurrentDate(), SetDate()

CTDate.IsLeapYear

Syntax

bool IsLeapYear( )

Parameters

This method has no parameters.

Description

Indicates if the year component of a packed CTDATE type value is a leap year.

Return

IsLeapYear() returns true if the packed year is a leap year, and false otherwise.

See Also

Year()

CTDate.Month

Syntax

int Month( )

Parameters

This method has no parameters.

Description

Retrieves the month component of a packed CTDATE type value

Return

Month returns the unpacked month.

See Also

CTDate.Pack

Syntax

void Pack(int year, int month, int day)

Parameters

  • year [in] The year to pack.
  • month [in] The month to pack.
  • day [in] The day to pack.

Description

Packs a year, month and day value into a CTDATE type value.

Return

None.

See Also

Unpack()

CTDate.SetDate

Syntax

void SetDate(uint Date)

void SetDate( CTDate Date)

Parameters

  • Date [in] The new date to set to the CTDate object.

Description

Sets the date to the CTDate object.

Return

None.

See Also

GetDate()

CTDate.StringToDate

Syntax

void StringToDate(String str, DATE_TYPE DateType)

Parameters

  • str [in] The string object to be converted.
  • DateType [in] The date type format to be used in the conversion. Valid date formats are shown in "Data Types".

Description

Converts a String object to a date object.

Return

None.

See Also

DateToString()

CTDate.Unpack

Syntax

void Unpack(out int year, out int month, out int day)

Parameters

  • year [out] The unpacked year.
  • month [out] The unpacked month.
  • day [out] The unpacked day.

Description

Unpacks a CTDATE type value into a year, month and day values

Return

None.

See Also

Day(), DayOfWeek(), Month(), Pack(), Year()

CTDate.Year

Syntax

int Year( )

Parameters

This method has no parameters.

Description

Retrieves the year component of a packed CTDATE type value.

Return

Year returns the unpacked year.

See Also

Day(), Month(), Pack(), Unpack()