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