00001
00002
00003 #ifndef __DATE_TIME_H
00004 #define __DATE_TIME_H
00005
00006 #define GDTF_DEFAULT 0
00007
00008 #define GDTF_DAY_MONTH_YEAR 0x01
00009 #define GDTF_MONTH_DAY_YEAR 0x02
00010 #define GDTF_YEAR_DAY_MONTH 0x04
00011 #define GDTF_DATE_MASK 0x0f
00012
00013 #define GDTF_12HOUR 0x10
00014 #define GDTF_24HOUR 0x20
00015 #define GDTF_TIME_MASK 0xf0
00016
00018 class LgiClass GDateTime
00019 {
00020 int16 _Day;
00021 int16 _Year;
00022 int16 _Thousands;
00023
00024 int16 _Month;
00025 int16 _Seconds;
00026 int16 _Minutes;
00027 int16 _Hours;
00028
00029 uchar _Format;
00030 static uchar DefaultFormat;
00031
00032 public:
00033 GDateTime();
00034 ~GDateTime();
00035
00036
00037
00039 int Day() { return _Day; }
00041 void Day(int d) { _Day = d; }
00043 int Month() { return _Month; }
00045 void Month(int m) { _Month = m; }
00047 int Year() { return _Year; }
00049 void Year(int y) { _Year = y; }
00050
00051
00052 int Thousands() { return _Thousands; }
00053 void Thousands(int t) { _Thousands = t; }
00054 int Seconds() { return _Seconds; }
00055 void Seconds(int s) { _Seconds = s; }
00056 int Minutes() { return _Minutes; }
00057 void Minutes(int m) { _Minutes = m; }
00058 int Hours() { return _Hours; }
00059 void Hours(int h) { _Hours = h; }
00060
00061
00062 uchar GetFormat() { return _Format; }
00063 void SetFormat(uchar f) { _Format = f; }
00064 static uchar GetDefaultFormat();
00065 static void SetDefaultFormat(uchar f) { DefaultFormat = f; }
00066
00067
00068 int DayOfWeek();
00069
00070
00071
00073 void Get(char *Str);
00075 bool Get(int64 &s);
00077 void GetDate(char *Str);
00079 void GetTime(char *Str);
00080
00082 void SetNow();
00084 bool Set(char *Str);
00086 bool Set(int64 s);
00088 bool SetDate(char *Str);
00090 bool SetTime(char *Str);
00091
00092
00093 bool IsLeapYear(int Year = -1);
00094 bool IsSameDay(GDateTime &d);
00095 int DaysInMonth();
00096 void AddMinutes(int Minutes);
00097 void AddHours(int Hours);
00098 void AddDays(int Days);
00099 void AddMonths(int Months);
00100 int TimeZone();
00101 int TimeZoneOffset();
00102
00103
00104 int Sizeof();
00105 bool Serialize(class GFile &f, bool Write);
00106 bool Serialize(class ObjProperties *Props, char *Name, bool Write);
00107
00108
00109 bool operator <(GDateTime &dt);
00110 bool operator <=(GDateTime &dt);
00111 bool operator >(GDateTime &dt);
00112 bool operator >=(GDateTime &dt);
00113 bool operator ==(GDateTime &dt);
00114 bool operator !=(GDateTime &dt);
00115 int Compare(GDateTime *d);
00116
00117 GDateTime operator -(GDateTime &dt);
00118 GDateTime operator +(GDateTime &dt);
00119 GDateTime DiffMonths(GDateTime &dt);
00120 };
00121
00122 struct GTimeZone
00123 {
00124 public:
00125 float Offset;
00126 char *Text;
00127 };
00128
00129 extern GTimeZone GTimeZones[];
00130
00131 #endif