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