7#if !defined(OWL_DATE_H)
11#if defined(BI_HAS_PRAGMA_ONCE)
37static const JulTy jul1901 = 2415386L;
78 TDate(LPCTSTR str, LPCTSTR format =
nullptr);
85 int Between(
const TDate& d1,
const TDate& d2 )
const;
86 int CompareTo(
const TDate& )
const;
88 int DaysInMonth(
MonthTy month=0)
const;
89 DayTy DayOfMonth()
const;
90 DayTy FirstDayOfMonth()
const;
92 unsigned Hash()
const;
98 LPCTSTR NameOfDay()
const;
99 LPCTSTR NameOfMonth()
const;
106 int operator < (
const TDate& date )
const;
107 int operator <= (
const TDate& date )
const;
108 int operator > (
const TDate& date )
const;
109 int operator >= (
const TDate& date )
const;
110 int operator == (
const TDate& date )
const;
111 int operator != (
const TDate& date )
const;
120 void operator += (
int dd );
121 void operator -= (
int dd );
132 static LPCTSTR DayName(
DayTy weekDayNumber );
138 static int LeapYear(
YearTy year );
139 static LPCTSTR MonthName(
MonthTy monthNumber );
140 static HowToPrint SetPrintOption( HowToPrint h );
157 static void SetIntlNames(TDateType type,
const tchar** names);
158 static const tchar* GetIntlName(TDateType type,
int index);
162 static int AssertWeekDayNumber(
DayTy d );
163 static int AssertIndexOfMonth(
MonthTy m );
168 static HowToPrint PrintOption;
171 void ParseFrom(LPCTSTR strDate, LPCTSTR format =
nullptr);
191 ParseFrom(
const_cast<tistream&
>(s));
196 ParseFrom(str, format);
202 return Julnum >= d1.Julnum && Julnum <= d2.Julnum;
238 return Julnum < date.Julnum;
244 return Julnum <= date.Julnum;
250 return Julnum > date.Julnum;
256 return Julnum >= date.Julnum;
262 return Julnum == date.Julnum;
268 return Julnum != date.Julnum;
274 return Julnum - dt.Julnum;
310 return m>=1 && m<=12;
The TDate class represents a date.
YearTy Year() const
Returns the year of this TDate.
static int LeapYear(YearTy year)
LPCTSTR NameOfMonth() const
Returns this TDate's month string name.
int Between(const TDate &d1, const TDate &d2) const
Returns 1 if this TDate object is between d1 and d2, inclusive.
void operator--()
Decrements this TDate by 1.
int IsValid() const
Returns 1 if this TDate is valid, 0 otherwise.
unsigned Hash() const
Returns a hash value for the date.
TDate()
Construct a TDate with the current date.
static LPCTSTR MonthName(MonthTy monthNumber)
Returns the string name for the given monthNumber (1-12).
static int AssertIndexOfMonth(MonthTy m)
Returns 1 if m is between 1 and 12 inclusive, otherwise returns 0.
int operator==(const TDate &date) const
Returns 1 if this TDate is equal to date, otherwise returns 0.
int Leap() const
leap year?
void operator-=(int dd)
Subtracts dd from this TDate.
void operator++()
Increments this TDate by 1.
int operator>=(const TDate &date) const
Returns 1 if this TDate is greater than or equal to date, otherwise returns 0.
TDate(const tstring &s, const tstring &format)
static int AssertWeekDayNumber(DayTy d)
Returns 1 if d is between 1 and 7 inclusive, otherwise returns 0.
static LPCTSTR DayName(DayTy weekDayNumber)
Returns a string name for the weekday number.
DayTy FirstDayOfMonth() const
Returns the number of the first day of the month for this TDate.
void operator+=(int dd)
Adds dd to this TDate.
int operator<(const TDate &date) const
Returns 1 if this TDate precedes date. Otherwise returns 0.
JulTy operator-(const TDate &dt) const
Subtracts dt from this TDate and returns the difference.
MonthTy Month() const
Returns the month of this TDate.
HowToPrint
Lists different print formats.
int operator<=(const TDate &date) const
Returns 1 if this TDate is less than or equal to date, otherwise returns 0.
int operator!=(const TDate &date) const
Returns 1 if this TDate is not equal to date, otherwise returns 0.
DayTy WeekDay(DayTy day=0) const
Returns 1 (Monday) through 7 (Sunday).
LPCTSTR NameOfDay() const
Returns this TDate's day string name.
int operator>(const TDate &date) const
Returns 1 if this TDate is greater than date. otherwise returns 0.
TSystemTime is a class derived from the structure SYSTEMTIME.
The TTime class encapsulates time functions and characteristics.
ipstream, a specialized input stream derivative of pstream, is the base class for reading (extracting...
Base class for writing streamable objects.
Object Windows Library (OWLNext Core).
unsigned YearTy
Year type.
_OWLSTATICFUNC(static int) FindMatch(const tchar *str
unsigned long JulTy
Julian calendar type.
unsigned HashValue(TDate &d)
unsigned MonthTy
Month type.
General definitions used by all ObjectWindows programs.