Titus Information Systems, Inc.

Standard Library
TDate Class

This class is inherited from the TPresent class.  An instance of this class is used by the programmer to set, access, add to, subtract from, and otherwise maintain dates.  This class uses a four-byte date storage method known as CYMD, where the date is stored in four parts, one byte each, consisting of the century, the year in the century, the month, and the day.  For example, May 19, 2003 would be stored in four bytes with the values 20, 3, 5, and 19.  This class also uses an "absolute Julian" date, which is the number of days since the first day of A.D.  In other words, January 1, 0001 A.D. is day one and May 19, 2003 is day 731719.  The public member functions are as follows:

TDate::TDate()
This is the default constructor.  It sets the internal date to the current date.
TDate::TDate(CTime Date)
TDate(char*CYMD)
TDate(int Century, int Year, int Month, int Day)
These constructors set the internal date to the specified date.
long TDate::GetDate()
long TDate::GetDate(char*CYMD)
long TDate::GetDate(char*Century, char*Year, char*Month, char*Day)
long TDate::GetDate(CString&Text)
long TDate::GetDate(CTime&Text)
int TDate::GetYear()
int TDate::GetMonth()
int TDate::GetDay()
These member functions return the internal date in the format requested.  The CString format is mm/dd/yyyy.  The TDate::GetDate() functions also return TDate::ThisJulian.
char LeapYear()
static char LeapYear(short*Year)
These member functions return a one if the internal or specified year is a leap year, and a zero if not.  The result of these functions may be added or subtracted from Julian dates if they are after February 28th.
long TDate::SetDate()
long TDate::SetDate(TDate Date)
long TDate::SetDate(CTime Date)
long TDate::SetDate(char*CYMD)
long TDate::SetDate(CString Date)
long TDate::SetDate(int Century, int Year, int Month, int Day)
long TDate::SetDate(long Julian)
TDate& TDate::operator=(TDate Date)
TDate& TDate::operator=(CTime Date)
These member functions set the internal date from the format specified.  The version with no arguments set the internal date to the current date.  The CString format must be specified as mm/dd/yyyy with leading zeros optionally suppressed.  If a two-digit year is entered, the function will attempt to add the most logical century.  It is wise to always specify a four-digit year.  The TDate::SetDate() functions also return TDate::ThisJulian after it has been set.
long TDate::AddDate(char*CYMD)
long TDate::AddDate(TDate Date)
long TDate::AddDate(int Century, int Year, int Month, int Day)
TDate& TDate::operator+(TDate Date)
long TDate::SubtractDate(char*CYMD)
long TDate::SubtractDate(TDate Date)
long TDate::SubtractDate(int Century, int Year, int Month, int Day)
TDate& TDate::operator-(TDate Date)
These member functions adjust the internal date with the date specified.  The TDate::AddDate() and TDate::SubtractDate() functions also return TDate::ThisJulian after it has been set.
BOOL TDate::operator==(TDate& Date)
BOOL TDate::operator!=(TDate& Date)
BOOL TDate::operator>(TDate& Date)
BOOL TDate::operator<(TDate& Date)
BOOL TDate::operator>=(TDate& Date)
BOOL TDate::operator<=(TDate& Date)
These member functions compare the internal date with the date specified.  They return TRUE or FALSE based on the success or failure of the requested comparison.
long TDate::ThisJulian
This data member may be inherited.  It contains the "absolute Julian" date.  It is returned as the value of most member functions in addition to their other operations.
int TDate::Year
This data member may be inherited.  It is used for calculations which require the four-digit year.
union ThisDateDef {int i; char p[4];} ThisDate
This member structure may be inherited.  It stores the internal date in CYMD format.  ThisDate.i may be compared with that of another TDate class as a four-byte integer.  The four ThisDate.p variables contain the day, month, two-digit year, and century respectively.


[ CBinaryFile | TCommandLineInfo | CCommaFile | TDateCtrl | CDDE | CDdeClient | CDdeServer ]
[ CDirectoryLocator | CDirectoryDialog | CDirectoryFind | CDirectoryNew | CFileCopy | TFrameWnd ]
[ InterfaceExcel | CMaintFn | CPrintFile | CProcDialog | TPrintDialog | CProcPropertyPage ]
[ CProgress | CRegistry | CSDisCreate | CSDisFile | CSDisPage | CSDisView | CTableFile ]
[ CTaskIcon | TPresent | TTime | TDateTime | CTransferData | TWinApp | CXlTable ]

[ Stand-alone Programs | Standard Library | Conversion Functions | Utility Functions | COBOL Functions ]
[ Windows NT Library | COBOL Library | COBOL Interface | Command Prompt Abbreviations | Purchase Instructions ]

[ Home | Areas of Expertise | "We Do Windows" | Clients and Projects | Software Samples | Package Software Available ]
[ Contact Information | Business Software Philosophy | Church Software Philosophy ]
All contents of this web site are Copyright © Titus Information Systems, Inc., Phoenix, Arizona, U.S.A.