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