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