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