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