00001
00041 #if !defined(O3DBI_O3DBIDATE_H)
00042 #define O3DBI_O3DBIDATE_H
00043
00044 #include "O3DBIObject.h"
00045 #include "time.h"
00046
00052 class O3DBIDate : public O3DBIObject
00053 {
00054
00055 public:
00059 O3DBIDate();
00073 O3DBIDate(int year, int month, int day, int hour, int minute, int second);
00080 O3DBIDate(const tm& t);
00087 O3DBIDate(time_t time);
00094 O3DBIDate(unsigned long ulJulianDay);
00100 O3DBIDate(const O3DBIDate& other);
00104 virtual ~O3DBIDate();
00105
00106
00107 public:
00112 O3DBIDate& operator=(const O3DBIDate& other);
00119 O3DBIDate& operator=(const tm& t);
00126 O3DBIDate& operator=(time_t time);
00132 bool operator==(const O3DBIDate& other) const;
00137 bool operator!=(const O3DBIDate& other) const;
00142 bool operator>=(const O3DBIDate& other) const;
00147 bool operator>(const O3DBIDate& other) const;
00152 bool operator<(const O3DBIDate& other) const;
00157 bool operator<=(const O3DBIDate& other) const;
00163 TO3DBIEra GetEra(void) const;
00164 int GetYear(void) const;
00165 void SetYear(int year);
00166 int GetMonth(void) const;
00167 void SetMonth(int month);
00168 int GetDay(void) const;
00169 void SetDay(int day);
00170 int GetHour(void) const;
00171 void SetHour(int hour);
00172 int GetMinute(void) const;
00173 void SetMinute(int minute);
00174 int GetSecond(void) const;
00175 void SetSecond(int second);
00180 bool IsLeapYear(void) const;
00185 unsigned short GetDayOfWeek(void) const;
00190 int GetDayOfYear(void) const;
00196 int GetCalendarWeek(void) const;
00204 long GetJulianDay(void) const;
00248 TO3DBIString GetAsString(PC_TCHAR pchFormat = NULL) const;
00249 virtual TO3DBIString ToString(void) const;
00250
00251
00252 protected:
00253 bool RangeCheck(void) const;
00254 bool JumpFromJulianToGregorian(void) const;
00255
00256
00257 protected:
00258 struct DateValue
00259 {
00260 int _year;
00261 int _month;
00262 int _day;
00263 int _hour;
00264 int _minute;
00265 int _second;
00266 } _value;
00267
00268 private:
00269 static int _arrDaysInMonth[13];
00270 };
00271
00272 #endif // !defined(O3DBI_O3DBIDATE_H)