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