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