]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/datetime.tex
1. fixed crash in wxDateTime::ParseDate
[wxWidgets.git] / docs / latex / wx / datetime.tex
CommitLineData
d7da9756
VZ
1%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2%% Name: datetime.tex
3%% Purpose: wxDateTime documentation
4%% Author: Vadim Zeitlin
5%% Modified by:
6%% Created: 07.03.00
7%% RCS-ID: $Id$
8%% Copyright: (c) Vadim Zeitlin
9%% Licence: wxWindows licence
10%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11
12\section{\class{wxDateTime}}\label{wxdatetime}
13
14wxDateTime class represents an absolute moment in the time.
15
16\wxheading{Types}
17
18The type {\tt wxDateTime\_t} is typedefed as {\tt unsigned short} and is used
19to contain the number of years, hours, minutes, seconds and milliseconds.
20
21\wxheading{Constants}
22
66f55ec6 23Global constant {\tt wxDefaultDateTime} and synonym for it {\tt wxInvalidDateTime} are defined. This constant will be different from any valid
d7da9756
VZ
24wxDateTime object.
25
26All the following constants are defined inside wxDateTime class (i.e., to refer to
27them you should prepend their names with {\tt wxDateTime::}).
28
fa482912 29Time zone symbolic names:
d7da9756
VZ
30
31\begin{verbatim}
32 enum TZ
33 {
34 // the time in the current time zone
35 Local,
36
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
40
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,
44 GMT0,
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
49
50 // some symbolic names for TZ
51
52 // Europe
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
61
62 // US and Canada
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
76
77 // Australia
78
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
83
84 // Universal Coordinated Time = the new and politically correct name
85 // for GMT
86 UTC = GMT0
87 };
88\end{verbatim}
89
90Month names: Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec and
91Inv\_Month for an invalid.month value are the values of {\tt wxDateTime::Month}
92enum.
93
94Likely, Sun, Mon, Tue, Wed, Thu, Fri, Sat, and Inv\_WeekDay are the values in
95{\tt wxDateTime::WeekDay} enum.
96
97Finally, Inv\_Year is defined to be an invalid value for year parameter.
98
99\wxheading{Derived from}
100
101No base class
102
103\wxheading{Include files}
104
105<wx/datetime.h>
106
107\wxheading{See also}
108
66f55ec6
JS
109%\helpref{Date classes overview}{wxdatetimeoverview},\rtfsp
110wxTimeSpan,\rtfsp
111wxDateSpan,\rtfsp
d7da9756
VZ
112\helpref{wxCalendarCtrl}{wxcalendarctrl}
113
114\latexignore{\rtfignore{\wxheading{Function groups}}}
115
116\membersection{Static functions}
117
fa482912 118For convenience, all static functions are collected here. These functions
d7da9756
VZ
119either set or return the static variables of wxDateSpan (the country), return
120the current moment, year, month or number of days in it, or do some general
121calendar-related actions.
122
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}
141
142\membersection{Constructors, assignment operators and setters}
143
144\membersection{Accessors}
145
146\membersection{Date comparison}
147
148\membersection{Date arithmetics}
149
150\membersection{Parsing and formatting dates}
151
152\membersection{Calendar calculations}
153
154\membersection{Astronomical/historical functions}
155
156\membersection{Time zone support}
157
158\helponly{\insertatlevel{2}{
159
160\wxheading{Members}
161
162}}
163
66f55ec6 164\membersection{wxDateTime::ConvertYearToBC}\label{wxdatetimeconvertyeartobc}
d7da9756 165
66f55ec6 166\func{static int}{ConvertYearToBC}{\param{int }{year}}
d7da9756
VZ
167
168Converts the year in absolute notation (i.e. a number which can be negative,
169positive or zero) to the year in BC/AD notation. For the positive years,
170nothing is done, but the year 0 is year 1 BC and so for other years there is a
171difference of 1.
172
173This function should be used like this:
174
175\begin{verbatim}
176 wxDateTime dt(...);
177 int y = dt.GetYear();
178 printf("The year is %d%s", wxDateTime::ConvertYearToBC(y), y > 0 ? "AD" : "BC");
179\end{verbatim}
180
66f55ec6 181\membersection{wxDateTime::GetAmPmStrings}\label{wxdatetimegetampmstrings}
d7da9756
VZ
182
183\func{static void}{GetAmPmStrings}{\param{wxString *}{am}, \param{wxString *}{pm}}
184
66f55ec6 185\membersection{wxDateTime::GetBeginDST}\label{wxdatetimegetbegindst}
d7da9756
VZ
186
187\func{static wxDateTime}{GetBeginDST}{\param{int }{year = Inv\_Year}, \param{Country }{country = Country\_Default}}
188
66f55ec6 189\membersection{wxDateTime::GetCountry}\label{wxdatetimegetcountry}
d7da9756
VZ
190
191\func{static Country}{GetCountry}{\void}
192
66f55ec6 193\membersection{wxDateTime::GetCurrentYear}\label{wxdatetimegetcurrentyear}
d7da9756
VZ
194
195\func{static int}{GetCurrentYear}{\param{Calendar }{cal = Gregorian}}
196
66f55ec6 197\membersection{wxDateTime::GetCurrentMonth}\label{wxdatetimegetcurrentmonth}
d7da9756
VZ
198
199\func{static Month}{GetCurrentMonth}{\param{Calendar }{cal = Gregorian}}
200
66f55ec6 201\membersection{wxDateTime::GetCentury}\label{wxdatetimegetcentury}
d7da9756
VZ
202
203\func{static int}{GetCentury}{\param{int }{year = Inv\_Year}}
204
66f55ec6 205\membersection{wxDateTime::GetEndDST}\label{wxdatetimegetenddst}
d7da9756
VZ
206
207\func{static wxDateTime}{GetEndDST}{\param{int }{year = Inv\_Year}, \param{Country }{country = Country\_Default}}
208
66f55ec6 209\membersection{wxDateTime::GetMonthName}\label{wxdatetimegetmonthname}
d7da9756
VZ
210
211\func{static wxString}{GetMonthName}{\param{Month }{month}, \param{NameFlags }{flags = Name\_Full}}
212
66f55ec6 213\membersection{wxDateTime::GetNumberOfDays}\label{wxdatetimegetnumberofdays}
d7da9756
VZ
214
215\func{static wxDateTime\_t}{GetNumberOfDays}{\param{int }{year}, \param{Calendar }{cal = Gregorian}}
216
d7da9756
VZ
217\func{static wxDateTime\_t}{GetNumberOfDays}{\param{Month }{month}, \param{int }{year = Inv\_Year}, \param{Calendar }{cal = Gregorian}}
218
66f55ec6 219\membersection{wxDateTime::GetWeekDayName}\label{wxdatetimegetweekdayname}
d7da9756
VZ
220
221\func{static wxString}{GetWeekDayName}{\param{WeekDay }{weekday}, \param{NameFlags }{flags = Name\_Full}}
222
66f55ec6 223\membersection{wxDateTime::IsLeapYear}\label{wxdatetimeisleapyear}
d7da9756
VZ
224
225\func{static bool}{IsLeapYear}{\param{int }{year = Inv\_Year}, \param{Calendar }{cal = Gregorian}}
226
66f55ec6 227\membersection{wxDateTime::IsWestEuropeanCountry}\label{wxdatetimeiswesteuropeancountry}
d7da9756
VZ
228
229\func{static bool}{IsWestEuropeanCountry}{\param{Country }{country = Country\_Default}}
230
66f55ec6 231\membersection{wxDateTime::IsDSTApplicable}\label{wxdatetimeisdstapplicable}
d7da9756
VZ
232
233\func{static bool}{IsDSTApplicable}{\param{int }{year = Inv\_Year}, \param{Country }{country = Country\_Default}}
234
66f55ec6 235\membersection{wxDateTime::Now}\label{wxdatetimenow}
d7da9756
VZ
236
237\func{static wxDateTime}{Now}{\void}
238
66f55ec6 239\membersection{wxDateTime::SetCountry}\label{wxdatetimesetcountry}
d7da9756
VZ
240
241\func{static void}{SetCountry}{\param{Country }{country}}
242
66f55ec6 243\membersection{wxDateTime::Today}\label{wxdatetimetoday}
d7da9756
VZ
244
245\func{static wxDateTime}{Today}{\void}
246