1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 %% Purpose: wxDateTime documentation
4 %% Author: Vadim Zeitlin
8 %% Copyright: (c) Vadim Zeitlin
9 %% Licence: wxWindows licence
10 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12 \section{\class{wxDateTime
}}\label{wxdatetime
}
14 wxDateTime class represents an absolute moment in the time.
18 The type
{\tt wxDateTime
\_t} is typedefed as
{\tt unsigned short
} and is used
19 to contain the number of years, hours, minutes, seconds and milliseconds.
23 Global constant
{\tt wxDefaultDateTime
} and synonym for it
{\tt wxInvalidDateTime
} are defined. This constant will be different from any valid
26 All the following constants are defined inside wxDateTime class (i.e., to refer to
27 them you should prepend their names with
{\tt wxDateTime::
}).
29 Time zone symbolic names:
34 // the time in the current time zone
37 // zones from GMT (= Greenwhich Mean Time): they're guaranteed to be
38 // consequent numbers, so writing something like `GMT0 + offset' is
39 // safe if abs(offset) <=
12
41 // underscore stands for minus
42 GMT_12, GMT_11, GMT_10, GMT_9, GMT_8, GMT_7,
43 GMT_6, GMT_5, GMT_4, GMT_3, GMT_2, GMT_1,
45 GMT1, GMT2, GMT3, GMT4, GMT5, GMT6,
46 GMT7, GMT8, GMT9, GMT10, GMT11, GMT12,
47 // Note that GMT12 and GMT_12 are not the same: there is a difference
48 // of exactly one day between them
50 // some symbolic names for TZ
53 WET = GMT0, // Western Europe Time
54 WEST = GMT1, // Western Europe Summer Time
55 CET = GMT1, // Central Europe Time
56 CEST = GMT2, // Central Europe Summer Time
57 EET = GMT2, // Eastern Europe Time
58 EEST = GMT3, // Eastern Europe Summer Time
59 MSK = GMT3, // Moscow Time
60 MSD = GMT4, // Moscow Summer Time
63 AST = GMT_4, // Atlantic Standard Time
64 ADT = GMT_3, // Atlantic Daylight Time
65 EST = GMT_5, // Eastern Standard Time
66 EDT = GMT_4, // Eastern Daylight Saving Time
67 CST = GMT_6, // Central Standard Time
68 CDT = GMT_5, // Central Daylight Saving Time
69 MST = GMT_7, // Mountain Standard Time
70 MDT = GMT_6, // Mountain Daylight Saving Time
71 PST = GMT_8, // Pacific Standard Time
72 PDT = GMT_7, // Pacific Daylight Saving Time
73 HST = GMT_10, // Hawaiian Standard Time
74 AKST = GMT_9, // Alaska Standard Time
75 AKDT = GMT_8, // Alaska Daylight Saving Time
79 A_WST = GMT8, // Western Standard Time
80 A_CST = GMT12 +
1, // Central Standard Time (+
9.5)
81 A_EST = GMT10, // Eastern Standard Time
82 A_ESST = GMT11, // Eastern Summer Time
84 // Universal Coordinated Time = the new and politically correct name
90 Month names: Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec and
91 Inv
\_Month for an invalid.month value are the values of
{\tt wxDateTime::Month
}
94 Likely, Sun, Mon, Tue, Wed, Thu, Fri, Sat, and Inv
\_WeekDay are the values in
95 {\tt wxDateTime::WeekDay
} enum.
97 Finally, Inv
\_Year is defined to be an invalid value for year parameter.
99 \wxheading{Derived from
}
103 \wxheading{Include files
}
109 %\helpref{Date classes overview}{wxdatetimeoverview},\rtfsp
112 \helpref{wxCalendarCtrl
}{wxcalendarctrl
}
114 \latexignore{\rtfignore{\wxheading{Function groups
}}}
116 \membersection{Static functions
}
118 For convenience, all static functions are collected here. These functions
119 either set or return the static variables of wxDateSpan (the country), return
120 the current moment, year, month or number of days in it, or do some general
121 calendar-related actions.
123 \helpref{SetCountry
}{wxdatetimesetcountry
}\\
124 \helpref{GetCountry
}{wxdatetimegetcountry
}\\
125 \helpref{IsWestEuropeanCountry
}{wxdatetimeiswesteuropeancountry
}\\
126 \helpref{GetCurrentYear
}{wxdatetimegetcurrentyear
}\\
127 \helpref{ConvertYearToBC
}{wxdatetimeconvertyeartobc
}\\
128 \helpref{GetCurrentMonth
}{wxdatetimegetcurrentmonth
}\\
129 \helpref{IsLeapYear
}{wxdatetimeisleapyear
}\\
130 \helpref{GetCentury
}{wxdatetimegetcentury
}\\
131 \helpref{GetNumberOfDays
}{wxdatetimegetnumberofdays
}\\
132 \helpref{GetNumberOfDays
}{wxdatetimegetnumberofdays
}\\
133 \helpref{GetMonthName
}{wxdatetimegetmonthname
}\\
134 \helpref{GetWeekDayName
}{wxdatetimegetweekdayname
}\\
135 \helpref{GetAmPmStrings
}{wxdatetimegetampmstrings
}\\
136 \helpref{IsDSTApplicable
}{wxdatetimeisdstapplicable
}\\
137 \helpref{GetBeginDST
}{wxdatetimegetbegindst
}\\
138 \helpref{GetEndDST
}{wxdatetimegetenddst
}\\
139 \helpref{Now
}{wxdatetimenow
}\\
140 \helpref{Today
}{wxdatetimetoday
}
142 \membersection{Constructors, assignment operators and setters
}
144 \membersection{Accessors
}
146 \membersection{Date comparison
}
148 \membersection{Date arithmetics
}
150 \membersection{Parsing and formatting dates
}
152 \membersection{Calendar calculations
}
154 \membersection{Astronomical/historical functions
}
156 \membersection{Time zone support
}
158 \helponly{\insertatlevel{2}{
164 \membersection{wxDateTime::ConvertYearToBC
}\label{wxdatetimeconvertyeartobc
}
166 \func{static int
}{ConvertYearToBC
}{\param{int
}{year
}}
168 Converts the year in absolute notation (i.e. a number which can be negative,
169 positive or zero) to the year in BC/AD notation. For the positive years,
170 nothing is done, but the year
0 is year
1 BC and so for other years there is a
173 This function should be used like this:
177 int y = dt.GetYear();
178 printf("The year is
%d%s", wxDateTime::ConvertYearToBC(y), y > 0 ? "AD" : "BC");
181 \membersection{wxDateTime::GetAmPmStrings
}\label{wxdatetimegetampmstrings
}
183 \func{static void
}{GetAmPmStrings
}{\param{wxString *
}{am
},
\param{wxString *
}{pm
}}
185 \membersection{wxDateTime::GetBeginDST
}\label{wxdatetimegetbegindst
}
187 \func{static wxDateTime
}{GetBeginDST
}{\param{int
}{year = Inv
\_Year},
\param{Country
}{country = Country
\_Default}}
189 \membersection{wxDateTime::GetCountry
}\label{wxdatetimegetcountry
}
191 \func{static Country
}{GetCountry
}{\void}
193 \membersection{wxDateTime::GetCurrentYear
}\label{wxdatetimegetcurrentyear
}
195 \func{static int
}{GetCurrentYear
}{\param{Calendar
}{cal = Gregorian
}}
197 \membersection{wxDateTime::GetCurrentMonth
}\label{wxdatetimegetcurrentmonth
}
199 \func{static Month
}{GetCurrentMonth
}{\param{Calendar
}{cal = Gregorian
}}
201 \membersection{wxDateTime::GetCentury
}\label{wxdatetimegetcentury
}
203 \func{static int
}{GetCentury
}{\param{int
}{year = Inv
\_Year}}
205 \membersection{wxDateTime::GetEndDST
}\label{wxdatetimegetenddst
}
207 \func{static wxDateTime
}{GetEndDST
}{\param{int
}{year = Inv
\_Year},
\param{Country
}{country = Country
\_Default}}
209 \membersection{wxDateTime::GetMonthName
}\label{wxdatetimegetmonthname
}
211 \func{static wxString
}{GetMonthName
}{\param{Month
}{month
},
\param{NameFlags
}{flags = Name
\_Full}}
213 \membersection{wxDateTime::GetNumberOfDays
}\label{wxdatetimegetnumberofdays
}
215 \func{static wxDateTime
\_t}{GetNumberOfDays
}{\param{int
}{year
},
\param{Calendar
}{cal = Gregorian
}}
217 \func{static wxDateTime
\_t}{GetNumberOfDays
}{\param{Month
}{month
},
\param{int
}{year = Inv
\_Year},
\param{Calendar
}{cal = Gregorian
}}
219 \membersection{wxDateTime::GetWeekDayName
}\label{wxdatetimegetweekdayname
}
221 \func{static wxString
}{GetWeekDayName
}{\param{WeekDay
}{weekday
},
\param{NameFlags
}{flags = Name
\_Full}}
223 \membersection{wxDateTime::IsLeapYear
}\label{wxdatetimeisleapyear
}
225 \func{static bool
}{IsLeapYear
}{\param{int
}{year = Inv
\_Year},
\param{Calendar
}{cal = Gregorian
}}
227 \membersection{wxDateTime::IsWestEuropeanCountry
}\label{wxdatetimeiswesteuropeancountry
}
229 \func{static bool
}{IsWestEuropeanCountry
}{\param{Country
}{country = Country
\_Default}}
231 \membersection{wxDateTime::IsDSTApplicable
}\label{wxdatetimeisdstapplicable
}
233 \func{static bool
}{IsDSTApplicable
}{\param{int
}{year = Inv
\_Year},
\param{Country
}{country = Country
\_Default}}
235 \membersection{wxDateTime::Now
}\label{wxdatetimenow
}
237 \func{static wxDateTime
}{Now
}{\void}
239 \membersection{wxDateTime::SetCountry
}\label{wxdatetimesetcountry
}
241 \func{static void
}{SetCountry
}{\param{Country
}{country
}}
243 \membersection{wxDateTime::Today
}\label{wxdatetimetoday
}
245 \func{static wxDateTime
}{Today
}{\void}