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