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