]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/datetime.tex
split wxSizer::Fit() into ComputeFittingWindow/ClientSize() that only does computatio...
[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
8795498c 9%% License: wxWindows license
d7da9756
VZ
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,
34f90a1c 46 GMT7, GMT8, GMT9, GMT10, GMT11, GMT12, GMT13,
d7da9756
VZ
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
34f90a1c 80 A_CST = GMT13 + 1, // Central Standard Time (+9.5)
d7da9756
VZ
81 A_EST = GMT10, // Eastern Standard Time
82 A_ESST = GMT11, // Eastern Summer Time
83
34f90a1c
VZ
84 // New Zealand
85 NZST = GMT12, // Standard Time
86 NZDT = GMT13, // Daylight Saving Time
87
d7da9756
VZ
88 // Universal Coordinated Time = the new and politically correct name
89 // for GMT
90 UTC = GMT0
91 };
92\end{verbatim}
93
94Month names: Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec and
f6bcfd97 95Inv\_Month for an invalid.month value are the values of {\tt wxDateTime::Month}
d7da9756
VZ
96enum.
97
f6bcfd97 98Likewise, Sun, Mon, Tue, Wed, Thu, Fri, Sat, and Inv\_WeekDay are the values in
d7da9756
VZ
99{\tt wxDateTime::WeekDay} enum.
100
101Finally, Inv\_Year is defined to be an invalid value for year parameter.
102
f6bcfd97 103\helpref{GetMonthName()}{wxdatetimegetmonthname} and
3103e8a9 104\helpref{GetWeekDayName}{wxdatetimegetweekdayname} functions use the following
f6bcfd97
BP
105flags:
106
107\begin{verbatim}
108 enum NameFlags
109 {
110 Name_Full = 0x01, // return full name
111 Name_Abbr = 0x02 // return abbreviated name
112 };
113\end{verbatim}
114
115Several functions accept an extra parameter specifying the calendar to use
116(although most of them only support now the Gregorian calendar). This
117parameters is one of the following values:
118
119\begin{verbatim}
120 enum Calendar
121 {
122 Gregorian, // calendar currently in use in Western countries
123 Julian // calendar in use since -45 until the 1582 (or later)
124 };
125\end{verbatim}
126
d3c7cfeb 127Date calculations often depend on the country and wxDateTime allows to set the
1aaf88d2 128country whose conventions should be used using
f6bcfd97
BP
129\helpref{SetCountry}{wxdatetimesetcountry}. It takes one of the following
130values as parameter:
131
132\begin{verbatim}
133 enum Country
134 {
135 Country_Unknown, // no special information for this country
136 Country_Default, // set the default country with SetCountry() method
137 // or use the default country with any other
138
139 Country_WesternEurope_Start,
140 Country_EEC = Country_WesternEurope_Start,
141 France,
142 Germany,
143 UK,
144 Country_WesternEurope_End = UK,
145
146 Russia,
147
148 USA
149 };
150\end{verbatim}
151
cdfb1ae1
VZ
152Different parts of the world use different conventions for the week start.
153In some countries, the week starts on Sunday, while in others -- on Monday.
f6bcfd97 154The ISO standard doesn't address this issue, so we support both conventions in
1aaf88d2 155the functions whose result depends on it (\helpref{GetWeekOfYear}{wxdatetimegetweekofyear} and
f6bcfd97
BP
156\helpref{GetWeekOfMonth}{wxdatetimegetweekofmonth}).
157
158The desired behvaiour may be specified by giving one of the following
159constants as argument to these functions:
160
161\begin{verbatim}
162 enum WeekFlags
163 {
164 Default_First, // Sunday_First for US, Monday_First for the rest
165 Monday_First, // week starts with a Monday
166 Sunday_First // week starts with a Sunday
167 };
168\end{verbatim}
169
d7da9756
VZ
170\wxheading{Derived from}
171
172No base class
173
174\wxheading{Include files}
175
176<wx/datetime.h>
177
a7af285d
VZ
178\wxheading{Library}
179
180\helpref{wxBase}{librarieslist}
181
d7da9756
VZ
182\wxheading{See also}
183
f6bcfd97 184\helpref{Date classes overview}{wxdatetimeoverview},\rtfsp
df05cdc5
VZ
185\helpref{wxTimeSpan}{wxtimespan},\rtfsp
186\helpref{wxDateSpan}{wxdatespan},\rtfsp
d7da9756
VZ
187\helpref{wxCalendarCtrl}{wxcalendarctrl}
188
189\latexignore{\rtfignore{\wxheading{Function groups}}}
190
4c27e2fa 191
b236c10f 192\membersection{Static functions}\label{datetimestaticfunctions}
d7da9756 193
fa482912 194For convenience, all static functions are collected here. These functions
d7da9756
VZ
195either set or return the static variables of wxDateSpan (the country), return
196the current moment, year, month or number of days in it, or do some general
197calendar-related actions.
198
f6bcfd97
BP
199Please note that although several function accept an extra {\it Calendar}
200parameter, it is currently ignored as only the Gregorian calendar is
201supported. Future versions will support other calendars.
202
1aaf88d2 203\pythonnote{These methods are standalone functions named
e7240349 204{\tt wxDateTime\_<StaticMethodName>} in wxPython.}
f6bcfd97 205
d7da9756
VZ
206\helpref{SetCountry}{wxdatetimesetcountry}\\
207\helpref{GetCountry}{wxdatetimegetcountry}\\
208\helpref{IsWestEuropeanCountry}{wxdatetimeiswesteuropeancountry}\\
209\helpref{GetCurrentYear}{wxdatetimegetcurrentyear}\\
210\helpref{ConvertYearToBC}{wxdatetimeconvertyeartobc}\\
211\helpref{GetCurrentMonth}{wxdatetimegetcurrentmonth}\\
212\helpref{IsLeapYear}{wxdatetimeisleapyear}\\
a333edbd 213\helpref{GetCentury}{wxdatetimegetcenturystatic}\\
d7da9756
VZ
214\helpref{GetNumberOfDays}{wxdatetimegetnumberofdays}\\
215\helpref{GetNumberOfDays}{wxdatetimegetnumberofdays}\\
216\helpref{GetMonthName}{wxdatetimegetmonthname}\\
217\helpref{GetWeekDayName}{wxdatetimegetweekdayname}\\
218\helpref{GetAmPmStrings}{wxdatetimegetampmstrings}\\
219\helpref{IsDSTApplicable}{wxdatetimeisdstapplicable}\\
220\helpref{GetBeginDST}{wxdatetimegetbegindst}\\
221\helpref{GetEndDST}{wxdatetimegetenddst}\\
222\helpref{Now}{wxdatetimenow}\\
f6bcfd97 223\helpref{UNow}{wxdatetimeunow}\\
d7da9756
VZ
224\helpref{Today}{wxdatetimetoday}
225
4c27e2fa 226
b236c10f 227\membersection{Constructors, assignment operators and setters}\label{datetimeconstructors}
d7da9756 228
f6bcfd97
BP
229Constructors and various {\tt Set()} methods are collected here. If you
230construct a date object from separate values for day, month and year, you
231should use \helpref{IsValid}{wxdatetimeisvalid} method to check that the
232values were correct as constructors can not return an error code.
233
234\helpref{wxDateTime()}{wxdatetimewxdatetimedef}\\
235\helpref{wxDateTime(time\_t)}{wxdatetimewxdatetimetimet}\\
236\helpref{wxDateTime(struct tm)}{wxdatetimewxdatetimetm}\\
237%\helpref{wxDateTime(struct Tm)}{wxdatetimewxdatetimetm} - Tm not documented yet\\
238\helpref{wxDateTime(double jdn)}{wxdatetimewxdatetimejdn}\\
239\helpref{wxDateTime(h, m, s, ms)}{wxdatetimewxdatetimetime}\\
240\helpref{wxDateTime(day, mon, year, h, m, s, ms)}{wxdatetimewxdatetimedate}\\
241\helpref{SetToCurrent}{wxdatetimesettocurrent}\\
242\helpref{Set(time\_t)}{wxdatetimesettimet}\\
243\helpref{Set(struct tm)}{wxdatetimesettm}\\
244%\helpref{Set(struct Tm)}{wxdatetimesettm} - Tm not documented yet\\
245\helpref{Set(double jdn)}{wxdatetimesetjdn}\\
246\helpref{Set(h, m, s, ms)}{wxdatetimesettime}\\
247\helpref{Set(day, mon, year, h, m, s, ms)}{wxdatetimesetdate}\\
2b5f62a0 248\helpref{SetFromDOS(unsigned long ddt)}{wxdatetimesetfromdos}\\
f6bcfd97
BP
249\helpref{ResetTime}{wxdatetimeresettime}\\
250\helpref{SetYear}{wxdatetimesetyear}\\
251\helpref{SetMonth}{wxdatetimesetmonth}\\
252\helpref{SetDay}{wxdatetimesetdate}\\
253\helpref{SetHour}{wxdatetimesethour}\\
254\helpref{SetMinute}{wxdatetimesetminute}\\
255\helpref{SetSecond}{wxdatetimesetsecond}\\
256\helpref{SetMillisecond}{wxdatetimesetmillisecond}\\
257\helpref{operator$=$(time\_t)}{wxdatetimeoperatoreqtimet}\\
d2c2afc9 258\helpref{operator$=$(struct tm)}{wxdatetimeoperatoreqtm}\rtfsp
f6bcfd97 259
4c27e2fa 260
b236c10f 261\membersection{Accessors}\label{datetimeaccessors}
d7da9756 262
f6bcfd97 263Here are the trivial accessors. Other functions, which might have to perform
1aaf88d2 264some more complicated calculations to find the answer are under the
b236c10f 265\helpref{Calendar calculations}{datetimecalculations} section.
f6bcfd97
BP
266
267\helpref{IsValid}{wxdatetimeisvalid}\\
268\helpref{GetTicks}{wxdatetimegetticks}\\
a333edbd 269\helpref{GetCentury}{wxdatetimegetcentury}\\
f6bcfd97
BP
270\helpref{GetYear}{wxdatetimegetyear}\\
271\helpref{GetMonth}{wxdatetimegetmonth}\\
272\helpref{GetDay}{wxdatetimegetday}\\
273\helpref{GetWeekDay}{wxdatetimegetweekday}\\
274\helpref{GetHour}{wxdatetimegethour}\\
cdfb1ae1 275\helpref{GetMinute}{wxdatetimegetminute}\\
f6bcfd97
BP
276\helpref{GetSecond}{wxdatetimegetsecond}\\
277\helpref{GetMillisecond}{wxdatetimegetmillisecond}\\
278\helpref{GetDayOfYear}{wxdatetimegetdayofyear}\\
279\helpref{GetWeekOfYear}{wxdatetimegetweekofyear}\\
280\helpref{GetWeekOfMonth}{wxdatetimegetweekofmonth}\\
281\helpref{GetYearDay}{wxdatetimegetyearday}\\
282\helpref{IsWorkDay}{wxdatetimeisworkday}\\
2b5f62a0
VZ
283\helpref{IsGregorianDate}{wxdatetimeisgregoriandate}\\
284\helpref{GetAsDOS}{wxdatetimegetasdos}
f6bcfd97 285
4c27e2fa 286
b236c10f 287\membersection{Date comparison}\label{datecomparison}
d7da9756 288
f6bcfd97
BP
289There are several function to allow date comparison. To supplement them, a few
290global operators $>$, $<$ etc taking wxDateTime are defined.
291
292\helpref{IsEqualTo}{wxdatetimeisequalto}\\
293\helpref{IsEarlierThan}{wxdatetimeisearlierthan}\\
294\helpref{IsLaterThan}{wxdatetimeislaterthan}\\
295\helpref{IsStrictlyBetween}{wxdatetimeisstrictlybetween}\\
296\helpref{IsBetween}{wxdatetimeisbetween}\\
297\helpref{IsSameDate}{wxdatetimeissamedate}\\
298\helpref{IsSameTime}{wxdatetimeissametime}\\
299\helpref{IsEqualUpTo}{wxdatetimeisequalupto}
300
4c27e2fa 301
b236c10f 302\membersection{Date arithmetics}\label{datearithmetics}
d7da9756 303
f6bcfd97
BP
304These functions carry out \helpref{arithmetics}{tdatearithm} on the wxDateTime
305objects. As explained in the overview, either wxTimeSpan or wxDateSpan may be
306added to wxDateTime, hence all functions are overloaded to accept both
307arguments.
308
309Also, both {\tt Add()} and {\tt Subtract()} have both const and non-const
feb571a4 310version. The first one returns a new object which represents the
f6bcfd97
BP
311sum/difference of the original one with the argument while the second form
312modifies the object to which it is applied. The operators $-=$ and $+=$ are
313defined to be equivalent to the second forms of these functions.
314
315\helpref{Add(wxTimeSpan)}{wxdatetimeaddts}\\
316\helpref{Add(wxDateSpan)}{wxdatetimeaddds}\\
317\helpref{Subtract(wxTimeSpan)}{wxdatetimesubtractts}\\
318\helpref{Subtract(wxDateSpan)}{wxdatetimesubtractds}\\
319\helpref{Subtract(wxDateTime)}{wxdatetimesubtractdt}\\
320\helpref{oparator$+=$(wxTimeSpan)}{wxdatetimeaddts}\\
321\helpref{oparator$+=$(wxDateSpan)}{wxdatetimeaddds}\\
322\helpref{oparator$-=$(wxTimeSpan)}{wxdatetimesubtractts}\\
323\helpref{oparator$-=$(wxDateSpan)}{wxdatetimesubtractds}
324
4c27e2fa 325
b236c10f 326\membersection{Parsing and formatting dates}\label{datetimeparsing}
d7da9756 327
feb571a4 328These functions convert wxDateTime objects to and from text. The
f6bcfd97 329conversions to text are mostly trivial: you can either do it using the default
1aaf88d2
WS
330date and time representations for the current locale (
331\helpref{FormatDate}{wxdatetimeformatdate} and
f6bcfd97 332\helpref{FormatTime}{wxdatetimeformattime}), using the international standard
1aaf88d2 333representation defined by ISO 8601 (
f3f2e255
VZ
334\helpref{FormatISODate}{wxdatetimeformatisodate},
335\helpref{FormatISOTime}{wxdatetimeformatisotime} and
336\helpref{FormatISOCombined}{wxdatetimeformatisocombined}) or by specifying any
337format at all and using \helpref{Format}{wxdatetimeformat} directly.
f6bcfd97
BP
338
339The conversions from text are more interesting, as there are much more
1aaf88d2 340possibilities to care about. The simplest cases can be taken care of with
f6bcfd97
BP
341\helpref{ParseFormat}{wxdatetimeparseformat} which can parse any date in the
342given (rigid) format. \helpref{ParseRfc822Date}{wxdatetimeparserfc822date} is
cdfb1ae1 343another function for parsing dates in predefined format -- the one of RFC 822
f6bcfd97 344which (still...) defines the format of email messages on the Internet. This
1aaf88d2 345format can not be described with {\tt strptime(3)}-like format strings used by
f6bcfd97
BP
346\helpref{Format}{wxdatetimeformat}, hence the need for a separate function.
347
1aaf88d2
WS
348But the most interesting functions are
349\helpref{ParseTime}{wxdatetimeparsetime},
350\helpref{ParseDate}{wxdatetimeparsedate} and
cdfb1ae1
VZ
351\helpref{ParseDateTime}{wxdatetimeparsedatetime}. They try to parse the date
352ans time (or only one of them) in `free' format, i.e. allow them to be
353specified in any of possible ways. These functions will usually be used to
354parse the (interactive) user input which is not bound to be in any predefined
355format. As an example, \helpref{ParseDateTime}{wxdatetimeparsedatetime} can
1aaf88d2 356parse the strings such as {\tt "tomorrow"}, {\tt "March first"} and even
cdfb1ae1 357{\tt "next Sunday"}.
f6bcfd97 358
71ebd60b
VZ
359Finally notice that each of the parsing functions is available in several
360overloads: if the input string is a narrow (\texttt{char *}) string, then a
361narrow pointer is returned. If the input string is a wide string, a wide char
362pointer is returned. Finally, if the input parameter is a wxString, a narrow
363char pointer is also returned for backwards compatibility but there is also an
364additional argument of wxString::const\_iterator type in which, if it is not
365\NULL, an iterator pointing to the end of the scanned string part is returned.
366
f6bcfd97
BP
367\helpref{ParseFormat}{wxdatetimeparseformat}\\
368\helpref{ParseDateTime}{wxdatetimeparsedatetime}\\
369\helpref{ParseDate}{wxdatetimeparsedate}\\
370\helpref{ParseTime}{wxdatetimeparsetime}\\
f3f2e255
VZ
371\helpref{ParseISODate}{wxdatetimeparseisodate}\\
372\helpref{ParseISOTime}{wxdatetimeparseisotime}\\
373\helpref{ParseISOCombined}{wxdatetimeparseisocombined}\\
374\helpref{ParseRfc822Date}{wxdatetimeparserfc822date}\\
f6bcfd97
BP
375\helpref{Format}{wxdatetimeformat}\\
376\helpref{FormatDate}{wxdatetimeformatdate}\\
377\helpref{FormatTime}{wxdatetimeformattime}\\
f3f2e255 378\helpref{FormatISOCombined}{wxdatetimeformatisocombined}\\
f6bcfd97
BP
379\helpref{FormatISODate}{wxdatetimeformatisodate}\\
380\helpref{FormatISOTime}{wxdatetimeformatisotime}
381
4c27e2fa 382
b236c10f 383\membersection{Calendar calculations}\label{datetimecalculations}
f6bcfd97
BP
384
385The functions in this section perform the basic calendar calculations, mostly
386related to the week days. They allow to find the given week day in the
387week with given number (either in the month or in the year) and so on.
388
389All (non-const) functions in this section don't modify the time part of the
cdfb1ae1 390wxDateTime -- they only work with the date part of it.
f6bcfd97
BP
391
392\helpref{SetToWeekDayInSameWeek}{wxdatetimesettoweekdayinsameweek}\\
393\helpref{GetWeekDayInSameWeek}{wxdatetimegetweekdayinsameweek}\\
394\helpref{SetToNextWeekDay}{wxdatetimesettonextweekday}\\
395\helpref{GetNextWeekDay}{wxdatetimegetnextweekday}\\
396\helpref{SetToPrevWeekDay}{wxdatetimesettoprevweekday}\\
397\helpref{GetPrevWeekDay}{wxdatetimegetprevweekday}\\
398\helpref{SetToWeekDay}{wxdatetimesettoweekday}\\
399\helpref{GetWeekDay}{wxdatetimegetweekday2}\\
400\helpref{SetToLastWeekDay}{wxdatetimesettolastweekday}\\
401\helpref{GetLastWeekDay}{wxdatetimegetlastweekday}\\
4c27e2fa 402\helpref{SetToWeekOfYear}{wxdatetimesettoweekofyear}\\
f6bcfd97
BP
403\helpref{SetToLastMonthDay}{wxdatetimesettolastmonthday}\\
404\helpref{GetLastMonthDay}{wxdatetimegetlastmonthday}\\
405\helpref{SetToYearDay}{wxdatetimesettoyearday}\\
406\helpref{GetYearDay}{wxdatetimegetyearday}
d7da9756 407
4c27e2fa 408
b236c10f 409\membersection{Astronomical/historical functions}\label{astronomyhistoryfunctions}
d7da9756 410
f6bcfd97
BP
411Some degree of support for the date units used in astronomy and/or history is
412provided. You can construct a wxDateTime object from a
413\helpref{JDN}{wxdatetimesetjdn} and you may also get its JDN,
414\helpref{MJD}{wxdatetimegetmodifiedjuliandaynumber} or
415\helpref{Rata Die number}{wxdatetimegetratadie} from it.
416
417\helpref{wxDateTime(double jdn)}{wxdatetimewxdatetimejdn}\\
418\helpref{Set(double jdn)}{wxdatetimesetjdn}\\
419\helpref{GetJulianDayNumber}{wxdatetimegetjuliandaynumber}\\
420\helpref{GetJDN}{wxdatetimegetjdn}\\
421\helpref{GetModifiedJulianDayNumber}{wxdatetimegetmodifiedjuliandaynumber}\\
422\helpref{GetMJD}{wxdatetimegetmjd}\\
423\helpref{GetRataDie}{wxdatetimegetratadie}
424
4c27e2fa 425
b236c10f 426\membersection{Time zone and DST support}\label{datetimedstzone}
f6bcfd97
BP
427
428Please see the \helpref{time zone overview}{tdatetimezones} for more
3980000c 429information about time zones. Normally, these functions should be rarely used.
f6bcfd97 430
d26adb9d 431\helpref{FromTimezone}{wxdatetimefromtimezone}\\
f6bcfd97
BP
432\helpref{ToTimezone}{wxdatetimetotimezone}\\
433\helpref{MakeTimezone}{wxdatetimemaketimezone}\\
d26adb9d
VZ
434\helpref{MakeFromTimezone}{wxdatetimemakefromtimezone}\\
435\helpref{ToUTC}{wxdatetimetoutc}\\
436\helpref{MakeUTC}{wxdatetimemakeutc}\\
f6bcfd97
BP
437\helpref{GetBeginDST}{wxdatetimegetbegindst}\\
438\helpref{GetEndDST}{wxdatetimegetenddst}\\
439\helpref{IsDST}{wxdatetimeisdst}
d7da9756
VZ
440
441\helponly{\insertatlevel{2}{
442
443\wxheading{Members}
444
445}}
446
f6bcfd97
BP
447%%%%%%%%%%%%%%%%%%%%%%%%%%% static functions %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
448
4c27e2fa 449
66f55ec6 450\membersection{wxDateTime::ConvertYearToBC}\label{wxdatetimeconvertyeartobc}
d7da9756 451
66f55ec6 452\func{static int}{ConvertYearToBC}{\param{int }{year}}
d7da9756
VZ
453
454Converts the year in absolute notation (i.e. a number which can be negative,
455positive or zero) to the year in BC/AD notation. For the positive years,
456nothing is done, but the year 0 is year 1 BC and so for other years there is a
457difference of 1.
458
459This function should be used like this:
460
461\begin{verbatim}
462 wxDateTime dt(...);
463 int y = dt.GetYear();
464 printf("The year is %d%s", wxDateTime::ConvertYearToBC(y), y > 0 ? "AD" : "BC");
465\end{verbatim}
466
4c27e2fa 467
66f55ec6 468\membersection{wxDateTime::GetAmPmStrings}\label{wxdatetimegetampmstrings}
d7da9756
VZ
469
470\func{static void}{GetAmPmStrings}{\param{wxString *}{am}, \param{wxString *}{pm}}
471
f6bcfd97
BP
472Returns the translations of the strings {\tt AM} and {\tt PM} used for time
473formatting for the current locale. Either of the pointers may be {\tt NULL} if
474the corresponding value is not needed.
475
4c27e2fa 476
66f55ec6 477\membersection{wxDateTime::GetBeginDST}\label{wxdatetimegetbegindst}
d7da9756
VZ
478
479\func{static wxDateTime}{GetBeginDST}{\param{int }{year = Inv\_Year}, \param{Country }{country = Country\_Default}}
480
f6bcfd97
BP
481Get the beginning of DST for the given country in the given year (current one
482by default). This function suffers from limitations described in
483\helpref{DST overview}{tdatedst}.
484
485\wxheading{See also}
486
487\helpref{GetEndDST}{wxdatetimegetenddst}
488
4c27e2fa 489
66f55ec6 490\membersection{wxDateTime::GetCountry}\label{wxdatetimegetcountry}
d7da9756
VZ
491
492\func{static Country}{GetCountry}{\void}
493
f6bcfd97
BP
494Returns the current default country. The default country is used for DST
495calculations, for example.
496
497\wxheading{See also}
498
499\helpref{SetCountry}{wxdatetimesetcountry}
500
4c27e2fa 501
66f55ec6 502\membersection{wxDateTime::GetCurrentYear}\label{wxdatetimegetcurrentyear}
d7da9756
VZ
503
504\func{static int}{GetCurrentYear}{\param{Calendar }{cal = Gregorian}}
505
f6bcfd97
BP
506Get the current year in given calendar (only Gregorian is currently supported).
507
4c27e2fa 508
66f55ec6 509\membersection{wxDateTime::GetCurrentMonth}\label{wxdatetimegetcurrentmonth}
d7da9756
VZ
510
511\func{static Month}{GetCurrentMonth}{\param{Calendar }{cal = Gregorian}}
512
f6bcfd97
BP
513Get the current month in given calendar (only Gregorian is currently supported).
514
4c27e2fa 515
a333edbd 516\membersection{wxDateTime::GetCentury}\label{wxdatetimegetcenturystatic}
d7da9756 517
a333edbd 518\func{static int}{GetCentury}{\param{int }{year}}
d7da9756 519
f6bcfd97
BP
520Get the current century, i.e. first two digits of the year, in given calendar
521(only Gregorian is currently supported).
522
4c27e2fa 523
66f55ec6 524\membersection{wxDateTime::GetEndDST}\label{wxdatetimegetenddst}
d7da9756
VZ
525
526\func{static wxDateTime}{GetEndDST}{\param{int }{year = Inv\_Year}, \param{Country }{country = Country\_Default}}
527
f6bcfd97
BP
528Returns the end of DST for the given country in the given year (current one by
529default).
530
531\wxheading{See also}
532
533\helpref{GetBeginDST}{wxdatetimegetbegindst}
534
4c27e2fa 535
66f55ec6 536\membersection{wxDateTime::GetMonthName}\label{wxdatetimegetmonthname}
d7da9756
VZ
537
538\func{static wxString}{GetMonthName}{\param{Month }{month}, \param{NameFlags }{flags = Name\_Full}}
539
f6bcfd97
BP
540Gets the full (default) or abbreviated (specify {\tt Name\_Abbr} name of the
541given month.
542
543\wxheading{See also}
544
545\helpref{GetWeekDayName}{wxdatetimegetweekdayname}
546
4c27e2fa 547
66f55ec6 548\membersection{wxDateTime::GetNumberOfDays}\label{wxdatetimegetnumberofdays}
d7da9756
VZ
549
550\func{static wxDateTime\_t}{GetNumberOfDays}{\param{int }{year}, \param{Calendar }{cal = Gregorian}}
551
d7da9756
VZ
552\func{static wxDateTime\_t}{GetNumberOfDays}{\param{Month }{month}, \param{int }{year = Inv\_Year}, \param{Calendar }{cal = Gregorian}}
553
f6bcfd97
BP
554Returns the number of days in the given year or in the given month of the
555year.
556
557The only supported value for {\it cal} parameter is currently {\tt Gregorian}.
558
559\pythonnote{These two methods are named {\tt GetNumberOfDaysInYear}
560and {\tt GetNumberOfDaysInMonth} in wxPython.}
561
4c27e2fa 562
1b4e1b3a
WS
563\membersection{wxDateTime::GetTimeNow}\label{wxdatetimegettimenow}
564
565\func{static time\_t}{GetTimeNow}{\void}
566
567Returns the current time.
568
569
570\membersection{wxDateTime::GetTmNow}\label{wxdatetimegettmnow}
571
a452689b
SN
572\func{static struct tm *}{GetTmNow}{\param{struct tm *}{tm}}
573
574Returns the current time broken down, uses the buffer whose adress is
575passed to the function via {\it tm} to store the result.
1b4e1b3a 576
a452689b
SN
577\membersection{wxDateTime::GetTmNow}
578
579\func{static struct tm *}{GetTmNow}{\void}
1b4e1b3a 580
a452689b
SN
581Returns the current time broken down. Note that this function returns a
582pointer to a static buffer that's reused by calls to this function and
583certain C library functions (e.g. localtime). If there is any chance your
584code might be used in a multi-threaded application, you really should use
585the flavour of function \helpref{wxDateTime::GetTmNow}{wxdatetimegettmnow}
586taking a parameter.
1b4e1b3a 587
66f55ec6 588\membersection{wxDateTime::GetWeekDayName}\label{wxdatetimegetweekdayname}
d7da9756
VZ
589
590\func{static wxString}{GetWeekDayName}{\param{WeekDay }{weekday}, \param{NameFlags }{flags = Name\_Full}}
591
f6bcfd97
BP
592Gets the full (default) or abbreviated (specify {\tt Name\_Abbr} name of the
593given week day.
594
595\wxheading{See also}
596
597\helpref{GetMonthName}{wxdatetimegetmonthname}
598
4c27e2fa 599
66f55ec6 600\membersection{wxDateTime::IsLeapYear}\label{wxdatetimeisleapyear}
d7da9756
VZ
601
602\func{static bool}{IsLeapYear}{\param{int }{year = Inv\_Year}, \param{Calendar }{cal = Gregorian}}
603
cc81d32f 604Returns {\tt true} if the {\it year} is a leap one in the specified calendar.
f6bcfd97
BP
605
606This functions supports Gregorian and Julian calendars.
607
4c27e2fa 608
66f55ec6 609\membersection{wxDateTime::IsWestEuropeanCountry}\label{wxdatetimeiswesteuropeancountry}
d7da9756
VZ
610
611\func{static bool}{IsWestEuropeanCountry}{\param{Country }{country = Country\_Default}}
612
cc81d32f 613This function returns {\tt true} if the specified (or default) country is one
f6bcfd97
BP
614of Western European ones. It is used internally by wxDateTime to determine the
615DST convention and date and time formatting rules.
616
4c27e2fa 617
66f55ec6 618\membersection{wxDateTime::IsDSTApplicable}\label{wxdatetimeisdstapplicable}
d7da9756
VZ
619
620\func{static bool}{IsDSTApplicable}{\param{int }{year = Inv\_Year}, \param{Country }{country = Country\_Default}}
621
cc81d32f 622Returns {\tt true} if DST was used n the given year (the current one by
f6bcfd97
BP
623default) in the given country.
624
4c27e2fa 625
66f55ec6 626\membersection{wxDateTime::Now}\label{wxdatetimenow}
d7da9756
VZ
627
628\func{static wxDateTime}{Now}{\void}
629
2edb0bde 630Returns the object corresponding to the current time.
f6bcfd97
BP
631
632Example:
633
634\begin{verbatim}
635 wxDateTime now = wxDateTime::Now();
636 printf("Current time in Paris:\t%s\n", now.Format("%c", wxDateTime::CET).c_str());
637\end{verbatim}
638
1aaf88d2 639Note that this function is accurate up to second:
f6bcfd97 640\helpref{wxDateTime::UNow}{wxdatetimeunow} should be used for better precision
2edb0bde 641(but it is less efficient and might not be available on all platforms).
f6bcfd97
BP
642
643\wxheading{See also}
644
645\helpref{Today}{wxdatetimetoday}
646
4c27e2fa 647
66f55ec6 648\membersection{wxDateTime::SetCountry}\label{wxdatetimesetcountry}
d7da9756
VZ
649
650\func{static void}{SetCountry}{\param{Country }{country}}
651
f6bcfd97
BP
652Sets the country to use by default. This setting influences the DST
653calculations, date formatting and other things.
654
655The possible values for {\it country} parameter are enumerated in
656\helpref{wxDateTime constants section}{wxdatetime}.
657
658\wxheading{See also}
659
660\helpref{GetCountry}{wxdatetimegetcountry}
661
4c27e2fa 662
66f55ec6 663\membersection{wxDateTime::Today}\label{wxdatetimetoday}
d7da9756
VZ
664
665\func{static wxDateTime}{Today}{\void}
666
f6bcfd97
BP
667Returns the object corresponding to the midnight of the current day (i.e. the
668same as \helpref{Now()}{wxdatetimenow}, but the time part is set to $0$).
669
670\wxheading{See also}
671
672\helpref{Now}{wxdatetimenow}
673
4c27e2fa 674
f6bcfd97
BP
675\membersection{wxDateTime::UNow}\label{wxdatetimeunow}
676
677\func{static wxDateTime}{UNow}{\void}
678
2edb0bde 679Returns the object corresponding to the current time including the
f6bcfd97
BP
680milliseconds if a function to get time with such precision is available on the
681current platform (supported under most Unices and Win32).
682
683\wxheading{See also}
684
685\helpref{Now}{wxdatetimenow}
686
687%%%%%%%%%%%%%%%%%%%%%%%%%%% constructors &c %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
688
4c27e2fa 689
f6bcfd97
BP
690\membersection{wxDateTime::wxDateTime}\label{wxdatetimewxdatetimedef}
691
692\func{}{wxDateTime}{\void}
693
694Default constructor. Use one of {\tt Set()} functions to initialize the object
695later.
696
4c27e2fa 697
f6bcfd97
BP
698\membersection{wxDateTime::wxDateTime}\label{wxdatetimewxdatetimetimet}
699
700\func{wxDateTime\&}{wxDateTime}{\param{time\_t }{timet}}
701
702Same as \helpref{Set}{wxdatetimewxdatetimetimet}.
703
704\pythonnote{This constructor is named {\tt wxDateTimeFromTimeT} in wxPython.}
705
4c27e2fa 706
f6bcfd97
BP
707\membersection{wxDateTime::wxDateTime}\label{wxdatetimewxdatetimetm}
708
709\func{wxDateTime\&}{wxDateTime}{\param{const struct tm\& }{tm}}
710
711Same as \helpref{Set}{wxdatetimewxdatetimetm}
712
713\pythonnote{Unsupported.}
714
4c27e2fa 715
f6bcfd97
BP
716\membersection{wxDateTime::wxDateTime}\label{wxdatetimewxdatetimejdn}
717
718\func{wxDateTime\&}{wxDateTime}{\param{double }{jdn}}
719
720Same as \helpref{Set}{wxdatetimewxdatetimejdn}
721
722\pythonnote{This constructor is named {\tt wxDateTimeFromJDN} in wxPython.}
723
4c27e2fa 724
f6bcfd97
BP
725\membersection{wxDateTime::wxDateTime}\label{wxdatetimewxdatetimetime}
726
727\func{wxDateTime\&}{wxDateTime}{\param{wxDateTime\_t }{hour}, \param{wxDateTime\_t }{minute = 0}, \param{wxDateTime\_t }{second = 0}, \param{wxDateTime\_t }{millisec = 0}}
728
729Same as \helpref{Set}{wxdatetimewxdatetimetime}
730
731\pythonnote{This constructor is named {\tt wxDateTimeFromHMS} in wxPython.}
732
4c27e2fa 733
f6bcfd97
BP
734\membersection{wxDateTime::wxDateTime}\label{wxdatetimewxdatetimedate}
735
1aaf88d2 736\func{wxDateTime\&}{wxDateTime}{\param{wxDateTime\_t }{day}, \param{Month }{month = Inv\_Month}, \param{int}{ Inv\_Year},
a9d171bd 737\param{wxDateTime\_t }{hour = 0}, \param{wxDateTime\_t }{minute = 0}, \param{wxDateTime\_t }{second = 0}, \param{wxDateTime\_t }{millisec = 0}}
f6bcfd97
BP
738
739Same as \helpref{Set}{wxdatetimesetdate}
740
741\pythonnote{This constructor is named {\tt wxDateTimeFromDMY} in wxPython.}
742
4c27e2fa 743
f6bcfd97
BP
744\membersection{wxDateTime::SetToCurrent}\label{wxdatetimesettocurrent}
745
7af3ca16 746\func{wxDateTime\&}{SetToCurrent}{\void}
f6bcfd97
BP
747
748Sets the date and time of to the current values. Same as assigning the result
749of \helpref{Now()}{wxdatetimenow} to this object.
750
4c27e2fa 751
f6bcfd97
BP
752\membersection{wxDateTime::Set}\label{wxdatetimesettimet}
753
754\func{wxDateTime\&}{Set}{\param{time\_t }{timet}}
755
756Constructs the object from {\it timet} value holding the number of seconds
757since Jan 1, 1970.
758
759\pythonnote{This method is named {\tt SetTimeT} in wxPython.}
760
4c27e2fa 761
f6bcfd97
BP
762\membersection{wxDateTime::Set}\label{wxdatetimesettm}
763
764\func{wxDateTime\&}{Set}{\param{const struct tm\& }{tm}}
765
2edb0bde 766Sets the date and time from the broken down representation in the standard
f6bcfd97
BP
767{\tt tm} structure.
768
769\pythonnote{Unsupported.}
770
4c27e2fa 771
f6bcfd97
BP
772\membersection{wxDateTime::Set}\label{wxdatetimesetjdn}
773
774\func{wxDateTime\&}{Set}{\param{double }{jdn}}
775
776Sets the date from the so-called {\it Julian Day Number}.
777
778By definition, the Julian Day Number, usually abbreviated as JDN, of a
779particular instant is the fractional number of days since 12 hours Universal
2edb0bde 780Coordinated Time (Greenwich mean noon) on January 1 of the year -4712 in the
f6bcfd97
BP
781Julian proleptic calendar.
782
783\pythonnote{This method is named {\tt SetJDN} in wxPython.}
784
4c27e2fa 785
f6bcfd97
BP
786\membersection{wxDateTime::Set}\label{wxdatetimesettime}
787
788\func{wxDateTime\&}{Set}{\param{wxDateTime\_t }{hour}, \param{wxDateTime\_t }{minute = 0}, \param{wxDateTime\_t }{second = 0}, \param{wxDateTime\_t }{millisec = 0}}
789
790Sets the date to be equal to \helpref{Today}{wxdatetimetoday} and the time
791from supplied parameters.
792
793\pythonnote{This method is named {\tt SetHMS} in wxPython.}
794
4c27e2fa 795
f6bcfd97
BP
796\membersection{wxDateTime::Set}\label{wxdatetimesetdate}
797
fafcf127 798\func{wxDateTime\&}{Set}{\param{wxDateTime\_t }{day}, \param{Month }{month = Inv\_Month}, \param{int }{year = Inv\_Year}, \param{wxDateTime\_t }{hour = 0}, \param{wxDateTime\_t }{minute = 0}, \param{wxDateTime\_t }{second = 0}, \param{wxDateTime\_t }{millisec = 0}}
f6bcfd97
BP
799
800Sets the date and time from the parameters.
801
4c27e2fa 802
f6bcfd97
BP
803\membersection{wxDateTime::ResetTime}\label{wxdatetimeresettime}
804
805\func{wxDateTime\&}{ResetTime}{\void}
806
807Reset time to midnight (00:00:00) without changing the date.
808
4c27e2fa 809
f6bcfd97
BP
810\membersection{wxDateTime::SetYear}\label{wxdatetimesetyear}
811
812\func{wxDateTime\&}{SetYear}{\param{int }{year}}
813
814Sets the year without changing other date components.
815
4c27e2fa 816
f6bcfd97
BP
817\membersection{wxDateTime::SetMonth}\label{wxdatetimesetmonth}
818
819\func{wxDateTime\&}{SetMonth}{\param{Month }{month}}
820
821Sets the month without changing other date components.
822
4c27e2fa 823
f6bcfd97
BP
824\membersection{wxDateTime::SetDay}\label{wxdatetimesetday}
825
826\func{wxDateTime\&}{SetDay}{\param{wxDateTime\_t }{day}}
827
828Sets the day without changing other date components.
829
4c27e2fa 830
f6bcfd97
BP
831\membersection{wxDateTime::SetHour}\label{wxdatetimesethour}
832
833\func{wxDateTime\&}{SetHour}{\param{wxDateTime\_t }{hour}}
834
835Sets the hour without changing other date components.
836
4c27e2fa 837
f6bcfd97
BP
838\membersection{wxDateTime::SetMinute}\label{wxdatetimesetminute}
839
840\func{wxDateTime\&}{SetMinute}{\param{wxDateTime\_t }{minute}}
841
842Sets the minute without changing other date components.
843
4c27e2fa 844
f6bcfd97
BP
845\membersection{wxDateTime::SetSecond}\label{wxdatetimesetsecond}
846
847\func{wxDateTime\&}{SetSecond}{\param{wxDateTime\_t }{second}}
848
849Sets the second without changing other date components.
850
4c27e2fa 851
f6bcfd97
BP
852\membersection{wxDateTime::SetMillisecond}\label{wxdatetimesetmillisecond}
853
854\func{wxDateTime\&}{SetMillisecond}{\param{wxDateTime\_t }{millisecond}}
855
856Sets the millisecond without changing other date components.
857
4c27e2fa 858
f6bcfd97
BP
859\membersection{wxDateTime::operator$=$}\label{wxdatetimeoperatoreqtimet}
860
861\func{wxDateTime\&}{operator}{\param{time\_t }{timet}}
862
863Same as \helpref{Set}{wxdatetimesettimet}.
864
4c27e2fa 865
f6bcfd97
BP
866\membersection{wxDateTime::operator$=$}\label{wxdatetimeoperatoreqtm}
867
868\func{wxDateTime\&}{operator}{\param{const struct tm\& }{tm}}
869
870Same as \helpref{Set}{wxdatetimesettm}.
871
872%%%%%%%%%%%%%%%%%%%%%%%%%%% accessors %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
873
4c27e2fa 874
f6bcfd97
BP
875\membersection{wxDateTime::IsValid}\label{wxdatetimeisvalid}
876
877\constfunc{bool}{IsValid}{\void}
878
cc81d32f 879Returns {\tt true} if the object represents a valid time moment.
f6bcfd97 880
4c27e2fa 881
fb96cf85
VZ
882\membersection{wxDateTime::GetDateOnly}\label{wxdatetimegetdateonly}
883
884\constfunc{wxDateTime}{GetDateOnly}{\void}
885
886Returns the object having the same date component as this one but time of
88700:00:00.
888
889\newsince{2.8.2}
890
891\wxheading{See also}
892
893\helpref{ResetTime}{wxdatetimeresettime}
894
895
f6bcfd97
BP
896\membersection{wxDateTime::GetTm}\label{wxdatetimegettm}
897
898\constfunc{Tm}{GetTm}{\param{const TimeZone\& }{tz = Local}}
899
900Returns broken down representation of the date and time.
901
4c27e2fa 902
f6bcfd97
BP
903\membersection{wxDateTime::GetTicks}\label{wxdatetimegetticks}
904
905\constfunc{time\_t}{GetTicks}{\void}
906
907Returns the number of seconds since Jan 1, 1970. An assert failure will occur
908if the date is not in the range covered by {\tt time\_t} type.
909
4c27e2fa 910
a333edbd
VZ
911\membersection{wxDateTime::GetCentury}\label{wxdatetimegetcentury}
912
913\constfunc{int}{GetCentury}{\param{const TimeZone\& }{tz = Local}}
914
915Returns the century of this date.
916
917
f6bcfd97
BP
918\membersection{wxDateTime::GetYear}\label{wxdatetimegetyear}
919
920\constfunc{int}{GetYear}{\param{const TimeZone\& }{tz = Local}}
921
922Returns the year in the given timezone (local one by default).
923
4c27e2fa 924
f6bcfd97
BP
925\membersection{wxDateTime::GetMonth}\label{wxdatetimegetmonth}
926
927\constfunc{Month}{GetMonth}{\param{const TimeZone\& }{tz = Local}}
928
929Returns the month in the given timezone (local one by default).
930
4c27e2fa 931
f6bcfd97
BP
932\membersection{wxDateTime::GetDay}\label{wxdatetimegetday}
933
934\constfunc{wxDateTime\_t}{GetDay}{\param{const TimeZone\& }{tz = Local}}
935
936Returns the day in the given timezone (local one by default).
937
4c27e2fa 938
f6bcfd97
BP
939\membersection{wxDateTime::GetWeekDay}\label{wxdatetimegetweekday}
940
941\constfunc{WeekDay}{GetWeekDay}{\param{const TimeZone\& }{tz = Local}}
942
943Returns the week day in the given timezone (local one by default).
944
4c27e2fa 945
f6bcfd97
BP
946\membersection{wxDateTime::GetHour}\label{wxdatetimegethour}
947
948\constfunc{wxDateTime\_t}{GetHour}{\param{const TimeZone\& }{tz = Local}}
949
950Returns the hour in the given timezone (local one by default).
951
4c27e2fa 952
f6bcfd97
BP
953\membersection{wxDateTime::GetMinute}\label{wxdatetimegetminute}
954
955\constfunc{wxDateTime\_t}{GetMinute}{\param{const TimeZone\& }{tz = Local}}
956
957Returns the minute in the given timezone (local one by default).
958
4c27e2fa 959
f6bcfd97
BP
960\membersection{wxDateTime::GetSecond}\label{wxdatetimegetsecond}
961
962\constfunc{wxDateTime\_t}{GetSecond}{\param{const TimeZone\& }{tz = Local}}
963
964Returns the seconds in the given timezone (local one by default).
965
4c27e2fa 966
f6bcfd97
BP
967\membersection{wxDateTime::GetMillisecond}\label{wxdatetimegetmillisecond}
968
969\constfunc{wxDateTime\_t}{GetMillisecond}{\param{const TimeZone\& }{tz = Local}}
970
971Returns the milliseconds in the given timezone (local one by default).
972
4c27e2fa 973
f6bcfd97
BP
974\membersection{wxDateTime::GetDayOfYear}\label{wxdatetimegetdayofyear}
975
976\constfunc{wxDateTime\_t}{GetDayOfYear}{\param{const TimeZone\& }{tz = Local}}
977
978Returns the day of the year (in $1\ldots366$ range) in the given timezone
979(local one by default).
980
4c27e2fa 981
f6bcfd97
BP
982\membersection{wxDateTime::GetWeekOfYear}\label{wxdatetimegetweekofyear}
983
984\constfunc{wxDateTime\_t}{GetWeekOfYear}{\param{WeekFlags }{flags = Monday\_First}, \param{const TimeZone\& }{tz = Local}}
985
986Returns the number of the week of the year this date is in. The first week of
4c27e2fa
VZ
987the year is, according to international standards, the one containing Jan 4 or,
988equivalently, the first week which has Thursday in this year. Both of these
989definitions are the same as saying that the first week of the year must contain
990more than half of its days in this year. Accordingly, the week number will
154b6b0f 991always be in $1\ldots53$ range ($52$ for non-leap years).
f6bcfd97
BP
992
993The function depends on the \helpref{week start}{wxdatetime} convention
1aaf88d2 994specified by the {\it flags} argument but its results for
4c27e2fa
VZ
995\texttt{Sunday\_First} are not well-defined as the ISO definition quoted above
996applies to the weeks starting on Monday only.
997
f6bcfd97
BP
998
999\membersection{wxDateTime::GetWeekOfMonth}\label{wxdatetimegetweekofmonth}
1000
1001\constfunc{wxDateTime\_t}{GetWeekOfMonth}{\param{WeekFlags }{flags = Monday\_First}, \param{const TimeZone\& }{tz = Local}}
1002
1003Returns the ordinal number of the week in the month (in $1\ldots5$ range).
1004
1005As \helpref{GetWeekOfYear}{wxdatetimegetweekofyear}, this function supports
1006both conventions for the week start. See the description of these
1007\helpref{week start}{wxdatetime} conventions.
1008
4c27e2fa 1009
f6bcfd97
BP
1010\membersection{wxDateTime::IsWorkDay}\label{wxdatetimeisworkday}
1011
1012\constfunc{bool}{IsWorkDay}{\param{Country }{country = Country\_Default}}
1013
cc81d32f 1014Returns {\tt true} is this day is not a holiday in the given country.
f6bcfd97 1015
4c27e2fa 1016
f6bcfd97
BP
1017\membersection{wxDateTime::IsGregorianDate}\label{wxdatetimeisgregoriandate}
1018
1019\constfunc{bool}{IsGregorianDate}{\param{GregorianAdoption }{country = Gr\_Standard}}
1020
f70c0443 1021Returns {\tt true} if the given date is later than the date of adoption of the
f6bcfd97
BP
1022Gregorian calendar in the given country (and hence the Gregorian calendar
1023calculations make sense for it).
1024
2b5f62a0
VZ
1025%%%%%%%%%%%%%%%%%%%%%% dos date and time format %%%%%%%%%%%%%%%%%%%%%%%
1026
4c27e2fa 1027
2b5f62a0
VZ
1028\membersection{wxDateTime::SetFromDOS}\label{wxdatetimesetfromdos}
1029
1030\func{wxDateTime\&}{Set}{\param{unsigned long }{ddt}}
1031
1aaf88d2
WS
1032Sets the date from the date and time in
1033\urlref{DOS}{http://developer.novell.com/ndk/doc/smscomp/index.html?page=/ndk/doc/smscomp/sms\_docs/data/hc2vlu5i.html}
2b5f62a0
VZ
1034format.
1035
4c27e2fa 1036
2b5f62a0
VZ
1037\membersection{wxDateTime::GetAsDOS}\label{wxdatetimegetasdos}
1038
1039\constfunc{unsigned long}{GetAsDOS}{\void}
1040
1aaf88d2
WS
1041Returns the date and time in
1042\urlref{DOS}{http://developer.novell.com/ndk/doc/smscomp/index.html?page=/ndk/doc/smscomp/sms\_docs/data/hc2vlu5i.html}
2b5f62a0
VZ
1043format.
1044
f6bcfd97
BP
1045%%%%%%%%%%%%%%%%%%%%%%%%%%% comparison %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1046
4c27e2fa 1047
f6bcfd97
BP
1048\membersection{wxDateTime::IsEqualTo}\label{wxdatetimeisequalto}
1049
7af3ca16 1050\constfunc{bool}{IsEqualTo}{\param{const wxDateTime\& }{datetime}}
f6bcfd97 1051
cc81d32f 1052Returns {\tt true} if the two dates are strictly identical.
f6bcfd97 1053
4c27e2fa 1054
f6bcfd97
BP
1055\membersection{wxDateTime::IsEarlierThan}\label{wxdatetimeisearlierthan}
1056
7af3ca16 1057\constfunc{bool}{IsEarlierThan}{\param{const wxDateTime\& }{datetime}}
f6bcfd97 1058
cc81d32f 1059Returns {\tt true} if this date precedes the given one.
f6bcfd97 1060
4c27e2fa 1061
f6bcfd97
BP
1062\membersection{wxDateTime::IsLaterThan}\label{wxdatetimeislaterthan}
1063
7af3ca16 1064\constfunc{bool}{IsLaterThan}{\param{const wxDateTime\& }{datetime}}
f6bcfd97 1065
cc81d32f 1066Returns {\tt true} if this date is later than the given one.
f6bcfd97 1067
4c27e2fa 1068
f6bcfd97
BP
1069\membersection{wxDateTime::IsStrictlyBetween}\label{wxdatetimeisstrictlybetween}
1070
7af3ca16 1071\constfunc{bool}{IsStrictlyBetween}{\param{const wxDateTime\& }{t1}, \param{const wxDateTime\& }{t2}}
f6bcfd97 1072
cc81d32f 1073Returns {\tt true} if this date lies strictly between the two others,
f6bcfd97
BP
1074
1075\wxheading{See also}
1076
1077\helpref{IsBetween}{wxdatetimeisbetween}
1078
4c27e2fa 1079
f6bcfd97
BP
1080\membersection{wxDateTime::IsBetween}\label{wxdatetimeisbetween}
1081
7af3ca16 1082\constfunc{bool}{IsBetween}{\param{const wxDateTime\& }{t1}, \param{const wxDateTime\& }{t2}}
f6bcfd97 1083
cc81d32f
VS
1084Returns {\tt true} if \helpref{IsStrictlyBetween}{wxdatetimeisstrictlybetween}
1085is {\tt true} or if the date is equal to one of the limit values.
f6bcfd97
BP
1086
1087\wxheading{See also}
1088
1089\helpref{IsStrictlyBetween}{wxdatetimeisstrictlybetween}
1090
4c27e2fa 1091
f6bcfd97
BP
1092\membersection{wxDateTime::IsSameDate}\label{wxdatetimeissamedate}
1093
7af3ca16 1094\constfunc{bool}{IsSameDate}{\param{const wxDateTime\& }{dt}}
f6bcfd97 1095
cc81d32f 1096Returns {\tt true} if the date is the same without comparing the time parts.
f6bcfd97 1097
4c27e2fa 1098
f6bcfd97
BP
1099\membersection{wxDateTime::IsSameTime}\label{wxdatetimeissametime}
1100
7af3ca16 1101\constfunc{bool}{IsSameTime}{\param{const wxDateTime\& }{dt}}
f6bcfd97 1102
cc81d32f 1103Returns {\tt true} if the time is the same (although dates may differ).
f6bcfd97 1104
4c27e2fa 1105
f6bcfd97
BP
1106\membersection{wxDateTime::IsEqualUpTo}\label{wxdatetimeisequalupto}
1107
1108\constfunc{bool}{IsEqualUpTo}{\param{const wxDateTime\& }{dt}, \param{const wxTimeSpan\& }{ts}}
1109
cc81d32f 1110Returns {\tt true} if the date is equal to another one up to the given time
f6bcfd97
BP
1111interval, i.e. if the absolute difference between the two dates is less than
1112this interval.
1113
1114%%%%%%%%%%%%%%%%%%%%%%%%%%% arithmetics %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1115
4c27e2fa 1116
f6bcfd97
BP
1117\membersection{wxDateTime::Add}\label{wxdatetimeaddts}
1118
1119\constfunc{wxDateTime}{Add}{\param{const wxTimeSpan\& }{diff}}
1120
1121\func{wxDateTime\&}{Add}{\param{const wxTimeSpan\& }{diff}}
1122
1123\func{wxDateTime\&}{operator$+=$}{\param{const wxTimeSpan\& }{diff}}
1124
1125Adds the given time span to this object.
1126
1127\pythonnote{This method is named {\tt AddTS} in wxPython.}
1128
f6bcfd97 1129
4c27e2fa 1130
f6bcfd97
BP
1131\membersection{wxDateTime::Add}\label{wxdatetimeaddds}
1132
1133\constfunc{wxDateTime}{Add}{\param{const wxDateSpan\& }{diff}}
1134
1135\func{wxDateTime\&}{Add}{\param{const wxDateSpan\& }{diff}}
1136
1137\func{wxDateTime\&}{operator$+=$}{\param{const wxDateSpan\& }{diff}}
1138
1139Adds the given date span to this object.
1140
1141\pythonnote{This method is named {\tt AddDS} in wxPython.}
1142
673e6120 1143
4c27e2fa 1144
673e6120
VZ
1145\membersection{wxDateTime::Subtract}\label{wxdatetimesubtractts}
1146
1147\constfunc{wxDateTime}{Subtract}{\param{const wxTimeSpan\& }{diff}}
1148
1149\func{wxDateTime\&}{Subtract}{\param{const wxTimeSpan\& }{diff}}
1150
1151\func{wxDateTime\&}{operator$-=$}{\param{const wxTimeSpan\& }{diff}}
1152
1153Subtracts the given time span from this object.
1154
1155\pythonnote{This method is named {\tt SubtractTS} in wxPython.}
1156
1157
4c27e2fa 1158
f6bcfd97
BP
1159\membersection{wxDateTime::Subtract}\label{wxdatetimesubtractds}
1160
1161\constfunc{wxDateTime}{Subtract}{\param{const wxDateSpan\& }{diff}}
1162
1163\func{wxDateTime\&}{Subtract}{\param{const wxDateSpan\& }{diff}}
1164
1165\func{wxDateTime\&}{operator$-=$}{\param{const wxDateSpan\& }{diff}}
1166
1167Subtracts the given date span from this object.
1168
1169\pythonnote{This method is named {\tt SubtractDS} in wxPython.}
1170
673e6120 1171
4c27e2fa 1172
f6bcfd97
BP
1173\membersection{wxDateTime::Subtract}\label{wxdatetimesubtractdt}
1174
1175\constfunc{wxTimeSpan}{Subtract}{\param{const wxDateTime\& }{dt}}
1176
1177Subtracts another date from this one and returns the difference between them
1178as wxTimeSpan.
1179
1180%%%%%%%%%%%%%%%%%%%%%%%%%%% parsing/formatting %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1181
4c27e2fa 1182
f6bcfd97
BP
1183\membersection{wxDateTime::ParseRfc822Date}\label{wxdatetimeparserfc822date}
1184
71ebd60b
VZ
1185\func{const char *}{ParseRfc822Date}{\param{const wxString\& }{date}, \param{wxString::const\_iterator *}{end = \NULL}}
1186
1187\func{const char *}{ParseRfc822Date}{\param{const char* }{date}}
1188
1189\func{const wchar\_t *}{ParseRfc822Date}{\param{const wchar\_t* }{date}}
f6bcfd97 1190
71ebd60b 1191Parses the string \arg{date} looking for a date formatted according to the RFC
f6bcfd97
BP
1192822 in it. The exact description of this format may, of course, be found in
1193the RFC (section $5$), but, briefly, this is the format used in the headers of
1194Internet email messages and one of the most common strings expressing date in
1195this format may be something like {\tt "Sat, 18 Dec 1999 00:48:30 +0100"}.
1196
1197Returns {\tt NULL} if the conversion failed, otherwise return the pointer to
1198the character immediately following the part of the string which could be
1199parsed. If the entire string contains only the date in RFC 822 format,
1200the returned pointer will be pointing to a {\tt NUL} character.
1201
2edb0bde 1202This function is intentionally strict, it will return an error for any string
f6bcfd97
BP
1203which is not RFC 822 compliant. If you need to parse date formatted in more
1204free ways, you should use \helpref{ParseDateTime}{wxdatetimeparsedatetime} or
1205\helpref{ParseDate}{wxdatetimeparsedate} instead.
1206
4c27e2fa 1207
f6bcfd97
BP
1208\membersection{wxDateTime::ParseFormat}\label{wxdatetimeparseformat}
1209
71ebd60b
VZ
1210\func{const char *}{ParseFormat}{\param{const wxString\& }{date}, \param{const wxString\& }{format = wxDefaultDateTimeFormat}, \param{const wxDateTime\& }{dateDef = wxDefaultDateTime}, \param{wxString::const\_iterator *}{end = \NULL}}
1211
1212\func{const char *}{ParseFormat}{\param{const char *}{date}, \param{const wxString\& }{format = wxDefaultDateTimeFormat}, \param{const wxDateTime\& }{dateDef = wxDefaultDateTime}}
1213
1214\func{const wchar\_t *}{ParseFormat}{\param{const wchar\_t *}{date}, \param{const wxString\& }{format = wxDefaultDateTimeFormat}, \param{const wxDateTime\& }{dateDef = wxDefaultDateTime}}
f6bcfd97
BP
1215
1216This function parses the string {\it date} according to the given
1217{\it format}. The system {\tt strptime(3)} function is used whenever available,
654a0fa9
JS
1218but even if it is not, this function is still implemented, although support
1219for locale-dependent format specifiers such as {\tt "\%c"}, {\tt "\%x"} or {\tt "\%X"} may
1220not be perfect and GNU extensions such as {\tt "\%z"} and {\tt "\%Z"} are
1221not implemented. This function does handle the month and weekday
1222names in the current locale on all platforms, however.
f6bcfd97 1223
654a0fa9
JS
1224Please see the description of the ANSI C function {\tt strftime(3)} for the syntax
1225of the format string.
f6bcfd97
BP
1226
1227The {\it dateDef} parameter is used to fill in the fields which could not be
654a0fa9
JS
1228determined from the format string. For example, if the format is {\tt "\%d"} (the
1229ay of the month), the month and the year are taken from {\it dateDef}. If
1230it is not specified, \helpref{Today}{wxdatetimetoday} is used as the
f6bcfd97
BP
1231default date.
1232
1233Returns {\tt NULL} if the conversion failed, otherwise return the pointer to
1234the character which stopped the scan.
1235
4c27e2fa 1236
f6bcfd97
BP
1237\membersection{wxDateTime::ParseDateTime}\label{wxdatetimeparsedatetime}
1238
71ebd60b
VZ
1239\func{const char *}{ParseDateTime}{\param{const wxString\& }{datetime}, \param{wxString::const\_iterator *}{end = \NULL}}
1240
1241\func{const char *}{ParseDateTime}{\param{const char *}{datetime}}
1242
1243\func{const wchar\_t *}{ParseDateTime}{\param{const wchar\_t *}{datetime}}
f6bcfd97
BP
1244
1245Parses the string {\it datetime} containing the date and time in free format.
1246This function tries as hard as it can to interpret the given string as date
1247and time. Unlike \helpref{ParseRfc822Date}{wxdatetimeparserfc822date}, it
1248will accept anything that may be accepted and will only reject strings which
1249can not be parsed in any way at all.
1250
1251Returns {\tt NULL} if the conversion failed, otherwise return the pointer to
42413abf 1252the character which stopped the scan.
f6bcfd97 1253
4c27e2fa 1254
f6bcfd97
BP
1255\membersection{wxDateTime::ParseDate}\label{wxdatetimeparsedate}
1256
71ebd60b
VZ
1257\func{const char *}{ParseDate}{\param{const wxString\& }{date}, \param{wxString::const\_iterator *}{end = \NULL}}
1258
1259\func{const char *}{ParseDate}{\param{const char *}{date}}
1260
1261\func{const wchar\_t *}{ParseDate}{\param{const wchar\_t *}{date}}
f6bcfd97
BP
1262
1263This function is like \helpref{ParseDateTime}{wxdatetimeparsedatetime}, but it
1aaf88d2 1264only allows the date to be specified. It is thus less flexible then
f6bcfd97
BP
1265\helpref{ParseDateTime}{wxdatetimeparsedatetime}, but also has less chances to
1266misinterpret the user input.
1267
1268Returns {\tt NULL} if the conversion failed, otherwise return the pointer to
1269the character which stopped the scan.
1270
4c27e2fa 1271
f6bcfd97
BP
1272\membersection{wxDateTime::ParseTime}\label{wxdatetimeparsetime}
1273
71ebd60b
VZ
1274\func{const char *}{ParseTime}{\param{const wxString\& }{time}, \param{wxString::const\_iterator *}{end = \NULL}}
1275
1276\func{const char *}{ParseTime}{\param{const char *}{time}}
1277
1278\func{const wchar\_t *}{ParseTime}{\param{const wchar\_t *}{time}}
f6bcfd97
BP
1279
1280This functions is like \helpref{ParseDateTime}{wxdatetimeparsedatetime}, but
1281only allows the time to be specified in the input string.
1282
1283Returns {\tt NULL} if the conversion failed, otherwise return the pointer to
1284the character which stopped the scan.
1285
4c27e2fa 1286
f3f2e255
VZ
1287\membersection{wxDateTime::ParseISODate}\label{wxdatetimeparseisodate}
1288
1289\func{bool}{ParseISODate}{\param{const wxString\& }{date}}
1290
1291This function parses the date in ISO 8601 format (YYYY-MM-DD).
1292
1293Returns \true if the entire string was parsed successfully, \false otherwise.
1294
1295
1296\membersection{wxDateTime::ParseISOTime}\label{wxdatetimeparseisotime}
1297
1298\func{bool}{ParseISOTime}{\param{const wxString\& }{date}}
1299
1300This function parses the time in ISO 8601 format (HH:MM:SS).
1301
1302Returns \true if the entire string was parsed successfully, \false otherwise.
1303
1304
1305\membersection{wxDateTime::ParseISOCombined}\label{wxdatetimeparseisocombined}
1306
1307\func{bool}{ParseISOCombined}{\param{const wxString\& }{date}, \param{char }{sep = 'T'}}
1308
1309This function parses the string containing the date and time in ISO 8601
1310combined format (YYYY-MM-DDTHH:MM:SS). The separator between the date and time
1311parts must be equal to \arg{sep} for the function to succeed.
1312
1313Returns \true if the entire string was parsed successfully, \false otherwise.
1314
1315
f6bcfd97
BP
1316\membersection{wxDateTime::Format}\label{wxdatetimeformat}
1317
1aaf88d2 1318\constfunc{wxString }{Format}{\param{const wxChar *}{format = wxDefaultDateTimeFormat}, \param{const TimeZone\& }{tz = Local}}
f6bcfd97
BP
1319
1320This function does the same as the standard ANSI C {\tt strftime(3)} function.
1321Please see its description for the meaning of {\it format} parameter.
1322
fc2171bd 1323It also accepts a few wxWidgets-specific extensions: you can optionally specify
f6bcfd97 1324the width of the field to follow using {\tt printf(3)}-like syntax and the
2edb0bde 1325format specification {\tt \%l} can be used to get the number of milliseconds.
f6bcfd97
BP
1326
1327\wxheading{See also}
1328
1329\helpref{ParseFormat}{wxdatetimeparseformat}
1330
4c27e2fa 1331
f6bcfd97
BP
1332\membersection{wxDateTime::FormatDate}\label{wxdatetimeformatdate}
1333
1334\constfunc{wxString }{FormatDate}{\void}
1335
1336Identical to calling \helpref{Format()}{wxdatetimeformat} with {\tt "\%x"}
1337argument (which means `preferred date representation for the current locale').
1338
4c27e2fa 1339
f6bcfd97
BP
1340\membersection{wxDateTime::FormatTime}\label{wxdatetimeformattime}
1341
1342\constfunc{wxString }{FormatTime}{\void}
1343
1344Identical to calling \helpref{Format()}{wxdatetimeformat} with {\tt "\%X"}
1345argument (which means `preferred time representation for the current locale').
1346
4c27e2fa 1347
f3f2e255
VZ
1348\membersection{wxDateTime::FormatISOCombined}\label{wxdatetimeformatisocombined}
1349
1350\constfunc{wxString}{FormatISOCombined}{\param{char }{sep = 'T'}}
1351
1352Returns the combined date-time representation in the ISO 8601 format
1353(YYYY-MM-DDTHH:MM:SS). The \arg{sep} parameter default value produces the
1354result exactly corresponding to the ISO standard, but it can also be useful to
1355use a space as seprator if a more human-readable combined date-time
1356representation is needed.
1357
1358\wxheading{See also}
1359
1360\helpref{FormatISODate}{wxdatetimeformatisodate},\\
1361\helpref{FormatISOTime}{wxdatetimeformatisotime},\\
1362\helpref{ParseISOCombined}{wxdatetimeparseisocombined}
1363
1364
f6bcfd97
BP
1365\membersection{wxDateTime::FormatISODate}\label{wxdatetimeformatisodate}
1366
1367\constfunc{wxString }{FormatISODate}{\void}
1368
1369This function returns the date representation in the ISO 8601 format
1370(YYYY-MM-DD).
1371
4c27e2fa 1372
f6bcfd97
BP
1373\membersection{wxDateTime::FormatISOTime}\label{wxdatetimeformatisotime}
1374
1375\constfunc{wxString }{FormatISOTime}{\void}
1376
1377This function returns the time representation in the ISO 8601 format
1378(HH:MM:SS).
1379
1380%%%%%%%%%%%%%%%%%%%%%%%%%%% calendar calculations %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1381
4c27e2fa 1382
f6bcfd97
BP
1383\membersection{wxDateTime::SetToWeekDayInSameWeek}\label{wxdatetimesettoweekdayinsameweek}
1384
2b5f62a0 1385\func{wxDateTime\&}{SetToWeekDayInSameWeek}{\param{WeekDay }{weekday}, \param{WeekFlags}{flags = {\tt Monday\_First}}}
f6bcfd97
BP
1386
1387Adjusts the date so that it will still lie in the same week as before, but its
1388week day will be the given one.
1389
1390Returns the reference to the modified object itself.
1391
4c27e2fa 1392
f6bcfd97
BP
1393\membersection{wxDateTime::GetWeekDayInSameWeek}\label{wxdatetimegetweekdayinsameweek}
1394
2b5f62a0 1395\constfunc{wxDateTime}{GetWeekDayInSameWeek}{\param{WeekDay }{weekday}, \param{WeekFlags}{flags = {\tt Monday\_First}}}
f6bcfd97 1396
1aaf88d2 1397Returns the copy of this object to which
f6bcfd97
BP
1398\helpref{SetToWeekDayInSameWeek}{wxdatetimesettoweekdayinsameweek} was
1399applied.
1400
4c27e2fa 1401
f6bcfd97
BP
1402\membersection{wxDateTime::SetToNextWeekDay}\label{wxdatetimesettonextweekday}
1403
1404\func{wxDateTime\&}{SetToNextWeekDay}{\param{WeekDay }{weekday}}
1405
1406Sets the date so that it will be the first {\it weekday} following the current
1407date.
1408
1409Returns the reference to the modified object itself.
1410
4c27e2fa 1411
f6bcfd97
BP
1412\membersection{wxDateTime::GetNextWeekDay}\label{wxdatetimegetnextweekday}
1413
1414\constfunc{wxDateTime}{GetNextWeekDay}{\param{WeekDay }{weekday}}
1415
1416Returns the copy of this object to which
1417\helpref{SetToNextWeekDay}{wxdatetimesettonextweekday} was applied.
1418
4c27e2fa 1419
f6bcfd97
BP
1420\membersection{wxDateTime::SetToPrevWeekDay}\label{wxdatetimesettoprevweekday}
1421
1422\func{wxDateTime\&}{SetToPrevWeekDay}{\param{WeekDay }{weekday}}
1423
1424Sets the date so that it will be the last {\it weekday} before the current
1425date.
1426
1427Returns the reference to the modified object itself.
1428
4c27e2fa 1429
f6bcfd97
BP
1430\membersection{wxDateTime::GetPrevWeekDay}\label{wxdatetimegetprevweekday}
1431
1432\constfunc{wxDateTime}{GetPrevWeekDay}{\param{WeekDay }{weekday}}
1433
1434Returns the copy of this object to which
1435\helpref{SetToPrevWeekDay}{wxdatetimesettoprevweekday} was applied.
1436
4c27e2fa 1437
f6bcfd97
BP
1438\membersection{wxDateTime::SetToWeekDay}\label{wxdatetimesettoweekday}
1439
1440\func{bool}{SetToWeekDay}{\param{WeekDay }{weekday}, \param{int }{n = 1}, \param{Month }{month = Inv\_Month}, \param{int }{year = Inv\_Year}}
1441
1442Sets the date to the {\it n}-th {\it weekday} in the given month of the given
1443year (the current month and year are used by default). The parameter {\it n}
2edb0bde 1444may be either positive (counting from the beginning of the month) or negative
f6bcfd97
BP
1445(counting from the end of it).
1446
1447For example, {\tt SetToWeekDay(2, wxDateTime::Wed)} will set the date to the
1448second Wednesday in the current month and
cdfb1ae1 1449{\tt SetToWeekDay(-1, wxDateTime::Sun)} -- to the last Sunday in it.
f6bcfd97 1450
cc81d32f 1451Returns {\tt true} if the date was modified successfully, {\tt false}
f6bcfd97
BP
1452otherwise meaning that the specified date doesn't exist.
1453
4c27e2fa 1454
f6bcfd97
BP
1455\membersection{wxDateTime::GetWeekDay}\label{wxdatetimegetweekday2}
1456
1457\constfunc{wxDateTime}{GetWeekDay}{\param{WeekDay }{weekday}, \param{int }{n = 1}, \param{Month }{month = Inv\_Month}, \param{int }{year = Inv\_Year}}
1458
1459Returns the copy of this object to which
1460\helpref{SetToWeekDay}{wxdatetimesettoweekday} was applied.
1461
4c27e2fa 1462
f6bcfd97
BP
1463\membersection{wxDateTime::SetToLastWeekDay}\label{wxdatetimesettolastweekday}
1464
1465\func{bool}{SetToLastWeekDay}{\param{WeekDay }{weekday}, \param{Month }{month = Inv\_Month}, \param{int }{year = Inv\_Year}}
1466
1467The effect of calling this function is the same as of calling
1468{\tt SetToWeekDay(-1, weekday, month, year)}. The date will be set to the last
1469{\it weekday} in the given month and year (the current ones by default).
1470
cc81d32f 1471Always returns {\tt true}.
f6bcfd97 1472
4c27e2fa 1473
f6bcfd97
BP
1474\membersection{wxDateTime::GetLastWeekDay}\label{wxdatetimegetlastweekday}
1475
1476\func{wxDateTime}{GetLastWeekDay}{\param{WeekDay }{weekday}, \param{Month }{month = Inv\_Month}, \param{int }{year = Inv\_Year}}
1477
1478Returns the copy of this object to which
1479\helpref{SetToLastWeekDay}{wxdatetimesettolastweekday} was applied.
1480
f6bcfd97 1481
4c27e2fa 1482\membersection{wxDateTime::SetToWeekOfYear}\label{wxdatetimesettoweekofyear}
f6bcfd97 1483
4c27e2fa 1484\func{static wxDateTime}{SetToWeekOfYear}{\param{int }{year}, \param{wxDateTime\_t }{numWeek}, \param{WeekDay }{weekday = Mon}}
f6bcfd97 1485
4c27e2fa
VZ
1486Set the date to the given \arg{weekday} in the week number \arg{numWeek} of the
1487given \arg{year} . The number should be in range $1\ldots53$.
f6bcfd97 1488
4c27e2fa
VZ
1489Note that the returned date may be in a different year than the one passed to
1490this function because both the week $1$ and week $52$ or $53$ (for leap years)
1aaf88d2 1491contain days from different years. See
4c27e2fa
VZ
1492\helpref{GetWeekOfYear}{wxdatetimegetweekofyear} for the explanation of how the
1493year weeks are counted.
f6bcfd97 1494
f6bcfd97
BP
1495
1496\membersection{wxDateTime::SetToLastMonthDay}\label{wxdatetimesettolastmonthday}
1497
1498\func{wxDateTime\&}{SetToLastMonthDay}{\param{Month }{month = Inv\_Month}, \param{int }{year = Inv\_Year}}
1499
1500Sets the date to the last day in the specified month (the current one by
1501default).
1502
1503Returns the reference to the modified object itself.
1504
4c27e2fa 1505
f6bcfd97
BP
1506\membersection{wxDateTime::GetLastMonthDay}\label{wxdatetimegetlastmonthday}
1507
1508\constfunc{wxDateTime}{GetLastMonthDay}{\param{Month }{month = Inv\_Month}, \param{int }{year = Inv\_Year}}
1509
1510Returns the copy of this object to which
1511\helpref{SetToLastMonthDay}{wxdatetimesettolastmonthday} was applied.
1512
4c27e2fa 1513
f6bcfd97
BP
1514\membersection{wxDateTime::SetToYearDay}\label{wxdatetimesettoyearday}
1515
1516\func{wxDateTime\&}{SetToYearDay}{\param{wxDateTime\_t }{yday}}
1517
1518Sets the date to the day number {\it yday} in the same year (i.e., unlike the
1519other functions, this one does not use the current year). The day number
1520should be in the range $1\ldots366$ for the leap years and $1\ldots365$ for
1521the other ones.
1522
1523Returns the reference to the modified object itself.
1524
4c27e2fa 1525
f6bcfd97
BP
1526\membersection{wxDateTime::GetYearDay}\label{wxdatetimegetyearday}
1527
1528\constfunc{wxDateTime}{GetYearDay}{\param{wxDateTime\_t }{yday}}
1529
1530Returns the copy of this object to which
1531\helpref{SetToYearDay}{wxdatetimesettoyearday} was applied.
1532
1533%%%%%%%%%%%%%%%%%%%%%%%%%%% astronomical functions %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1534
4c27e2fa 1535
f6bcfd97
BP
1536\membersection{wxDateTime::GetJulianDayNumber}\label{wxdatetimegetjuliandaynumber}
1537
1538\constfunc{double}{GetJulianDayNumber}{\void}
1539
1540Returns the \helpref{JDN}{wxdatetimesetjdn} corresponding to this date. Beware
1541of rounding errors!
1542
1543\wxheading{See also}
1544
1545\helpref{GetModifiedJulianDayNumber}{wxdatetimegetmodifiedjuliandaynumber}
1546
4c27e2fa 1547
f6bcfd97
BP
1548\membersection{wxDateTime::GetJDN}\label{wxdatetimegetjdn}
1549
1550\constfunc{double}{GetJDN}{\void}
1551
1552Synonym for \helpref{GetJulianDayNumber}{wxdatetimegetjuliandaynumber}.
1553
4c27e2fa 1554
f6bcfd97
BP
1555\membersection{wxDateTime::GetModifiedJulianDayNumber}\label{wxdatetimegetmodifiedjuliandaynumber}
1556
1557\constfunc{double}{GetModifiedJulianDayNumber}{\void}
1558
1559Returns the {\it Modified Julian Day Number} (MJD) which is, by definition,
1560equal to $JDN - 2400000.5$. The MJDs are simpler to work with as the integral
1561MJDs correspond to midnights of the dates in the Gregorian calendar and not th
1562noons like JDN. The MJD $0$ is Nov 17, 1858.
1563
4c27e2fa 1564
f6bcfd97
BP
1565\membersection{wxDateTime::GetMJD}\label{wxdatetimegetmjd}
1566
1567\constfunc{double}{GetMJD}{\void}
1568
1569Synonym for \helpref{GetModifiedJulianDayNumber}{wxdatetimegetmodifiedjuliandaynumber}.
1570
4c27e2fa 1571
f6bcfd97
BP
1572\membersection{wxDateTime::GetRataDie}\label{wxdatetimegetratadie}
1573
1574\constfunc{double}{GetRataDie}{\void}
1575
1576Return the {\it Rata Die number} of this date.
1577
1578By definition, the Rata Die number is a date specified as the number of days
1579relative to a base date of December 31 of the year 0. Thus January 1 of the
1580year 1 is Rata Die day 1.
1581
1582%%%%%%%%%%%%%%%%%%%%%%%%%%% timezone and DST %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1583
4c27e2fa 1584
d26adb9d
VZ
1585\membersection{wxDateTime::FromTimezone}\label{wxdatetimefromtimezone}
1586
1587\constfunc{wxDateTime}{FromTimezone}{\param{const TimeZone\& }{tz}, \param{bool }{noDST = false}}
1588
1589Transform the date from the given time zone to the local one. If {\it noDST} is
1590{\tt true}, no DST adjustments will be made.
1591
1592Returns the date in the local time zone.
1593
1594
f6bcfd97
BP
1595\membersection{wxDateTime::ToTimezone}\label{wxdatetimetotimezone}
1596
cc81d32f 1597\constfunc{wxDateTime}{ToTimezone}{\param{const TimeZone\& }{tz}, \param{bool }{noDST = false}}
f6bcfd97 1598
cc81d32f 1599Transform the date to the given time zone. If {\it noDST} is {\tt true}, no
f6bcfd97
BP
1600DST adjustments will be made.
1601
1602Returns the date in the new time zone.
1603
4c27e2fa 1604
f6bcfd97
BP
1605\membersection{wxDateTime::MakeTimezone}\label{wxdatetimemaketimezone}
1606
cc81d32f 1607\func{wxDateTime\&}{MakeTimezone}{\param{const TimeZone\& }{tz}, \param{bool }{noDST = false}}
f6bcfd97
BP
1608
1609Modifies the object in place to represent the date in another time zone. If
cc81d32f 1610{\it noDST} is {\tt true}, no DST adjustments will be made.
f6bcfd97 1611
4c27e2fa 1612
d26adb9d
VZ
1613\membersection{wxDateTime::MakeFromTimezone}\label{wxdatetimemakefromtimezone}
1614
1615\func{wxDateTime\&}{MakeFromTimezone}{\param{const TimeZone\& }{tz}, \param{bool }{noDST = false}}
1616
1617Same as \helpref{FromTimezone}{wxdatetimefromtimezone} but modifies the object
1618in place.
1619
1620
1621\membersection{wxDateTime::ToUTC}\label{wxdatetimetoutc}
f6bcfd97 1622
d26adb9d 1623\constfunc{wxDateTime}{ToUTC}{\param{bool }{noDST = false}}
f6bcfd97
BP
1624
1625This is the same as calling \helpref{ToTimezone}{wxdatetimetotimezone} with
1626the argument {\tt GMT0}.
1627
4c27e2fa 1628
d26adb9d 1629\membersection{wxDateTime::MakeUTC}\label{wxdatetimemakeutc}
f6bcfd97 1630
d26adb9d 1631\func{wxDateTime\&}{MakeUTC}{\param{bool }{noDST = false}}
f6bcfd97
BP
1632
1633This is the same as calling \helpref{MakeTimezone}{wxdatetimemaketimezone} with
1634the argument {\tt GMT0}.
1635
4c27e2fa 1636
f6bcfd97
BP
1637\membersection{wxDateTime::IsDST}\label{wxdatetimeisdst}
1638
1639\constfunc{int}{IsDST}{\param{Country }{country = Country\_Default}}
1640
cc81d32f 1641Returns {\tt true} if the DST is applied for this date in the given country.
f6bcfd97
BP
1642
1643\wxheading{See also}
1644
1645\helpref{GetBeginDST}{wxdatetimegetbegindst} and
1646\helpref{GetEndDST}{wxdatetimegetenddst}
1647
1648\section{\class{wxDateTimeHolidayAuthority}}\label{wxdatetimeholidayauthority}
1649
991ad6cd
VZ
1650\wxheading{Derived from}
1651
1652No base class
1653
1654\wxheading{Include files}
1655
1656<wx/datetime.h>
1657
a7af285d
VZ
1658\wxheading{Library}
1659
1660\helpref{wxBase}{librarieslist}
1661
991ad6cd
VZ
1662\latexignore{\rtfignore{\wxheading{Members}}}
1663
f6bcfd97
BP
1664TODO
1665
1666\section{\class{wxDateTimeWorkDays}}\label{wxdatetimeworkdays}
1667
991ad6cd
VZ
1668\wxheading{Derived from}
1669
1670No base class
1671
1672\wxheading{Include files}
1673
1674<wx/datetime.h>
1675
a7af285d
VZ
1676\wxheading{Library}
1677
1678\helpref{wxBase}{librarieslist}
1679
991ad6cd
VZ
1680\latexignore{\rtfignore{\wxheading{Members}}}
1681
f6bcfd97
BP
1682TODO
1683