1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 %% Purpose: wxDateTime documentation
4 %% Author: Vadim Zeitlin
8 %% Copyright: (c) Vadim Zeitlin
9 %% License: wxWindows license
10 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12 \section{\class{wxDateTime
}}\label{wxdatetime
}
14 wxDateTime class represents an absolute moment in the time.
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.
23 Global constant
{\tt wxDefaultDateTime
} and synonym for it
{\tt wxInvalidDateTime
} are defined. This constant will be different from any valid
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::
}).
29 Time zone symbolic names:
34 // the time in the current time zone
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
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,
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
50 // some symbolic names for TZ
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
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
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
84 // Universal Coordinated Time = the new and politically correct name
90 Month names: Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec and
91 Inv
\_Month for an invalid.month value are the values of
{\tt wxDateTime::Month
}
94 Likewise, Sun, Mon, Tue, Wed, Thu, Fri, Sat, and Inv
\_WeekDay are the values in
95 {\tt wxDateTime::WeekDay
} enum.
97 Finally, Inv
\_Year is defined to be an invalid value for year parameter.
99 \helpref{GetMonthName()
}{wxdatetimegetmonthname
} and
100 \helpref{GetWeekDayName
}{wxdatetimegetweekdayname
} functions use the following
106 Name_Full =
0x01, // return full name
107 Name_Abbr =
0x02 // return abbreviated name
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:
118 Gregorian, // calendar currently in use in Western countries
119 Julian // calendar in use since -
45 until the
1582 (or later)
123 Date calculations often depend on the country and wxDateTime allows to set the
124 country whose conventions should be used using
125 \helpref{SetCountry
}{wxdatetimesetcountry
}. It takes one of the following
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
135 Country_WesternEurope_Start,
136 Country_EEC = Country_WesternEurope_Start,
140 Country_WesternEurope_End = UK,
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.
150 The ISO standard doesn't address this issue, so we support both conventions in
151 the functions whose result depends on it (
\helpref{GetWeekOfYear
}{wxdatetimegetweekofyear
} and
152 \helpref{GetWeekOfMonth
}{wxdatetimegetweekofmonth
}).
154 The desired behvaiour may be specified by giving one of the following
155 constants as argument to these functions:
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
166 \wxheading{Derived from
}
170 \wxheading{Include files
}
176 \helpref{Date classes overview
}{wxdatetimeoverview
},
\rtfsp
177 \helpref{wxTimeSpan
}{wxtimespan
},
\rtfsp
178 \helpref{wxDateSpan
}{wxdatespan
},
\rtfsp
179 \helpref{wxCalendarCtrl
}{wxcalendarctrl
}
181 \latexignore{\rtfignore{\wxheading{Function groups
}}}
184 \membersection{Static functions
}\label{datetimestaticfunctions
}
186 For convenience, all static functions are collected here. These functions
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.
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.
195 \pythonnote{These methods are standalone functions named
196 {\tt wxDateTime
\_<StaticMethodName>
} in wxPython.
}
198 \helpref{SetCountry
}{wxdatetimesetcountry
}\\
199 \helpref{GetCountry
}{wxdatetimegetcountry
}\\
200 \helpref{IsWestEuropeanCountry
}{wxdatetimeiswesteuropeancountry
}\\
201 \helpref{GetCurrentYear
}{wxdatetimegetcurrentyear
}\\
202 \helpref{ConvertYearToBC
}{wxdatetimeconvertyeartobc
}\\
203 \helpref{GetCurrentMonth
}{wxdatetimegetcurrentmonth
}\\
204 \helpref{IsLeapYear
}{wxdatetimeisleapyear
}\\
205 \helpref{GetCentury
}{wxdatetimegetcentury
}\\
206 \helpref{GetNumberOfDays
}{wxdatetimegetnumberofdays
}\\
207 \helpref{GetNumberOfDays
}{wxdatetimegetnumberofdays
}\\
208 \helpref{GetMonthName
}{wxdatetimegetmonthname
}\\
209 \helpref{GetWeekDayName
}{wxdatetimegetweekdayname
}\\
210 \helpref{GetAmPmStrings
}{wxdatetimegetampmstrings
}\\
211 \helpref{IsDSTApplicable
}{wxdatetimeisdstapplicable
}\\
212 \helpref{GetBeginDST
}{wxdatetimegetbegindst
}\\
213 \helpref{GetEndDST
}{wxdatetimegetenddst
}\\
214 \helpref{Now
}{wxdatetimenow
}\\
215 \helpref{UNow
}{wxdatetimeunow
}\\
216 \helpref{Today
}{wxdatetimetoday
}
219 \membersection{Constructors, assignment operators and setters
}\label{datetimeconstructors
}
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.
226 \helpref{wxDateTime()
}{wxdatetimewxdatetimedef
}\\
227 \helpref{wxDateTime(time
\_t)
}{wxdatetimewxdatetimetimet
}\\
228 \helpref{wxDateTime(struct tm)
}{wxdatetimewxdatetimetm
}\\
229 %\helpref{wxDateTime(struct Tm)}{wxdatetimewxdatetimetm} - Tm not documented yet\\
230 \helpref{wxDateTime(double jdn)
}{wxdatetimewxdatetimejdn
}\\
231 \helpref{wxDateTime(h, m, s, ms)
}{wxdatetimewxdatetimetime
}\\
232 \helpref{wxDateTime(day, mon, year, h, m, s, ms)
}{wxdatetimewxdatetimedate
}\\
233 \helpref{SetToCurrent
}{wxdatetimesettocurrent
}\\
234 \helpref{Set(time
\_t)
}{wxdatetimesettimet
}\\
235 \helpref{Set(struct tm)
}{wxdatetimesettm
}\\
236 %\helpref{Set(struct Tm)}{wxdatetimesettm} - Tm not documented yet\\
237 \helpref{Set(double jdn)
}{wxdatetimesetjdn
}\\
238 \helpref{Set(h, m, s, ms)
}{wxdatetimesettime
}\\
239 \helpref{Set(day, mon, year, h, m, s, ms)
}{wxdatetimesetdate
}\\
240 \helpref{SetFromDOS(unsigned long ddt)
}{wxdatetimesetfromdos
}\\
241 \helpref{ResetTime
}{wxdatetimeresettime
}\\
242 \helpref{SetYear
}{wxdatetimesetyear
}\\
243 \helpref{SetMonth
}{wxdatetimesetmonth
}\\
244 \helpref{SetDay
}{wxdatetimesetdate
}\\
245 \helpref{SetHour
}{wxdatetimesethour
}\\
246 \helpref{SetMinute
}{wxdatetimesetminute
}\\
247 \helpref{SetSecond
}{wxdatetimesetsecond
}\\
248 \helpref{SetMillisecond
}{wxdatetimesetmillisecond
}\\
249 \helpref{operator$=$(time
\_t)
}{wxdatetimeoperatoreqtimet
}\\
250 \helpref{operator$=$(struct tm)
}{wxdatetimeoperatoreqtm
}\rtfsp
253 \membersection{Accessors
}\label{datetimeaccessors
}
255 Here are the trivial accessors. Other functions, which might have to perform
256 some more complicated calculations to find the answer are under the
257 \helpref{Calendar calculations
}{datetimecalculations
} section.
259 \helpref{IsValid
}{wxdatetimeisvalid
}\\
260 \helpref{GetTicks
}{wxdatetimegetticks
}\\
261 \helpref{GetYear
}{wxdatetimegetyear
}\\
262 \helpref{GetMonth
}{wxdatetimegetmonth
}\\
263 \helpref{GetDay
}{wxdatetimegetday
}\\
264 \helpref{GetWeekDay
}{wxdatetimegetweekday
}\\
265 \helpref{GetHour
}{wxdatetimegethour
}\\
266 \helpref{GetMinute
}{wxdatetimegetminute
}\\
267 \helpref{GetSecond
}{wxdatetimegetsecond
}\\
268 \helpref{GetMillisecond
}{wxdatetimegetmillisecond
}\\
269 \helpref{GetDayOfYear
}{wxdatetimegetdayofyear
}\\
270 \helpref{GetWeekOfYear
}{wxdatetimegetweekofyear
}\\
271 \helpref{GetWeekOfMonth
}{wxdatetimegetweekofmonth
}\\
272 \helpref{GetYearDay
}{wxdatetimegetyearday
}\\
273 \helpref{IsWorkDay
}{wxdatetimeisworkday
}\\
274 \helpref{IsGregorianDate
}{wxdatetimeisgregoriandate
}\\
275 \helpref{GetAsDOS
}{wxdatetimegetasdos
}
278 \membersection{Date comparison
}\label{datecomparison
}
280 There are several function to allow date comparison. To supplement them, a few
281 global operators $>$, $<$ etc taking wxDateTime are defined.
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
}
293 \membersection{Date arithmetics
}\label{datearithmetics
}
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
300 Also, both
{\tt Add()
} and
{\tt Subtract()
} have both const and non-const
301 version. The first one returns a new object 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.
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
}
317 \membersection{Parsing and formatting dates
}\label{datetimeparsing
}
319 These functions convert wxDateTime objects to and from text. The
320 conversions to text are mostly trivial: you can either do it using the default
321 date and time representations for the current locale (
322 \helpref{FormatDate
}{wxdatetimeformatdate
} and
323 \helpref{FormatTime
}{wxdatetimeformattime
}), using the international standard
324 representation defined by ISO
8601 (
325 \helpref{FormatISODate
}{wxdatetimeformatisodate
} and
326 \helpref{FormatISOTime
}{wxdatetimeformatisotime
}) or by specifying any format
327 at all and using
\helpref{Format
}{wxdatetimeformat
} directly.
329 The conversions from text are more interesting, as there are much more
330 possibilities to care about. The simplest cases can be taken care of with
331 \helpref{ParseFormat
}{wxdatetimeparseformat
} which can parse any date in the
332 given (rigid) format.
\helpref{ParseRfc822Date
}{wxdatetimeparserfc822date
} is
333 another function for parsing dates in predefined format -- the one of RFC
822
334 which (still...) defines the format of email messages on the Internet. This
335 format can not be described with
{\tt strptime(
3)
}-like format strings used by
336 \helpref{Format
}{wxdatetimeformat
}, hence the need for a separate function.
338 But the most interesting functions are
339 \helpref{ParseTime
}{wxdatetimeparsetime
},
340 \helpref{ParseDate
}{wxdatetimeparsedate
} and
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
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
}
361 \membersection{Calendar calculations
}\label{datetimecalculations
}
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.
367 All (non-const) functions in this section don't modify the time part of the
368 wxDateTime -- they only work with the date part of it.
370 \helpref{SetToWeekDayInSameWeek
}{wxdatetimesettoweekdayinsameweek
}\\
371 \helpref{GetWeekDayInSameWeek
}{wxdatetimegetweekdayinsameweek
}\\
372 \helpref{SetToNextWeekDay
}{wxdatetimesettonextweekday
}\\
373 \helpref{GetNextWeekDay
}{wxdatetimegetnextweekday
}\\
374 \helpref{SetToPrevWeekDay
}{wxdatetimesettoprevweekday
}\\
375 \helpref{GetPrevWeekDay
}{wxdatetimegetprevweekday
}\\
376 \helpref{SetToWeekDay
}{wxdatetimesettoweekday
}\\
377 \helpref{GetWeekDay
}{wxdatetimegetweekday2
}\\
378 \helpref{SetToLastWeekDay
}{wxdatetimesettolastweekday
}\\
379 \helpref{GetLastWeekDay
}{wxdatetimegetlastweekday
}\\
380 \helpref{SetToWeekOfYear
}{wxdatetimesettoweekofyear
}\\
381 \helpref{SetToLastMonthDay
}{wxdatetimesettolastmonthday
}\\
382 \helpref{GetLastMonthDay
}{wxdatetimegetlastmonthday
}\\
383 \helpref{SetToYearDay
}{wxdatetimesettoyearday
}\\
384 \helpref{GetYearDay
}{wxdatetimegetyearday
}
387 \membersection{Astronomical/historical functions
}\label{astronomyhistoryfunctions
}
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.
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
}
404 \membersection{Time zone and DST support
}\label{datetimedstzone
}
406 Please see the
\helpref{time zone overview
}{tdatetimezones
} for more
407 information about time zones. Normally, these functions should be rarely used.
409 \helpref{FromTimezone
}{wxdatetimefromtimezone
}\\
410 \helpref{ToTimezone
}{wxdatetimetotimezone
}\\
411 \helpref{MakeTimezone
}{wxdatetimemaketimezone
}\\
412 \helpref{MakeFromTimezone
}{wxdatetimemakefromtimezone
}\\
413 \helpref{ToUTC
}{wxdatetimetoutc
}\\
414 \helpref{MakeUTC
}{wxdatetimemakeutc
}\\
415 \helpref{GetBeginDST
}{wxdatetimegetbegindst
}\\
416 \helpref{GetEndDST
}{wxdatetimegetenddst
}\\
417 \helpref{IsDST
}{wxdatetimeisdst
}
419 \helponly{\insertatlevel{2}{
425 %%%%%%%%%%%%%%%%%%%%%%%%%%% static functions %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
428 \membersection{wxDateTime::ConvertYearToBC
}\label{wxdatetimeconvertyeartobc
}
430 \func{static int
}{ConvertYearToBC
}{\param{int
}{year
}}
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
437 This function should be used like this:
441 int y = dt.GetYear();
442 printf("The year is
%d%s", wxDateTime::ConvertYearToBC(y), y > 0 ? "AD" : "BC");
446 \membersection{wxDateTime::GetAmPmStrings
}\label{wxdatetimegetampmstrings
}
448 \func{static void
}{GetAmPmStrings
}{\param{wxString *
}{am
},
\param{wxString *
}{pm
}}
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.
455 \membersection{wxDateTime::GetBeginDST
}\label{wxdatetimegetbegindst
}
457 \func{static wxDateTime
}{GetBeginDST
}{\param{int
}{year = Inv
\_Year},
\param{Country
}{country = Country
\_Default}}
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
}.
465 \helpref{GetEndDST
}{wxdatetimegetenddst
}
468 \membersection{wxDateTime::GetCountry
}\label{wxdatetimegetcountry
}
470 \func{static Country
}{GetCountry
}{\void}
472 Returns the current default country. The default country is used for DST
473 calculations, for example.
477 \helpref{SetCountry
}{wxdatetimesetcountry
}
480 \membersection{wxDateTime::GetCurrentYear
}\label{wxdatetimegetcurrentyear
}
482 \func{static int
}{GetCurrentYear
}{\param{Calendar
}{cal = Gregorian
}}
484 Get the current year in given calendar (only Gregorian is currently supported).
487 \membersection{wxDateTime::GetCurrentMonth
}\label{wxdatetimegetcurrentmonth
}
489 \func{static Month
}{GetCurrentMonth
}{\param{Calendar
}{cal = Gregorian
}}
491 Get the current month in given calendar (only Gregorian is currently supported).
494 \membersection{wxDateTime::GetCentury
}\label{wxdatetimegetcentury
}
496 \func{static int
}{GetCentury
}{\param{int
}{year = Inv
\_Year}}
498 Get the current century, i.e. first two digits of the year, in given calendar
499 (only Gregorian is currently supported).
502 \membersection{wxDateTime::GetEndDST
}\label{wxdatetimegetenddst
}
504 \func{static wxDateTime
}{GetEndDST
}{\param{int
}{year = Inv
\_Year},
\param{Country
}{country = Country
\_Default}}
506 Returns the end of DST for the given country in the given year (current one by
511 \helpref{GetBeginDST
}{wxdatetimegetbegindst
}
514 \membersection{wxDateTime::GetMonthName
}\label{wxdatetimegetmonthname
}
516 \func{static wxString
}{GetMonthName
}{\param{Month
}{month
},
\param{NameFlags
}{flags = Name
\_Full}}
518 Gets the full (default) or abbreviated (specify
{\tt Name
\_Abbr} name of the
523 \helpref{GetWeekDayName
}{wxdatetimegetweekdayname
}
526 \membersection{wxDateTime::GetNumberOfDays
}\label{wxdatetimegetnumberofdays
}
528 \func{static wxDateTime
\_t}{GetNumberOfDays
}{\param{int
}{year
},
\param{Calendar
}{cal = Gregorian
}}
530 \func{static wxDateTime
\_t}{GetNumberOfDays
}{\param{Month
}{month
},
\param{int
}{year = Inv
\_Year},
\param{Calendar
}{cal = Gregorian
}}
532 Returns the number of days in the given year or in the given month of the
535 The only supported value for
{\it cal
} parameter is currently
{\tt Gregorian
}.
537 \pythonnote{These two methods are named
{\tt GetNumberOfDaysInYear
}
538 and
{\tt GetNumberOfDaysInMonth
} in wxPython.
}
541 \membersection{wxDateTime::GetTimeNow
}\label{wxdatetimegettimenow
}
543 \func{static time
\_t}{GetTimeNow
}{\void}
545 Returns the current time.
548 \membersection{wxDateTime::GetTmNow
}\label{wxdatetimegettmnow
}
550 \func{static struct tm *
}{GetTmNow
}{\void}
552 Returns the current time broken down.
555 \membersection{wxDateTime::GetWeekDayName
}\label{wxdatetimegetweekdayname
}
557 \func{static wxString
}{GetWeekDayName
}{\param{WeekDay
}{weekday
},
\param{NameFlags
}{flags = Name
\_Full}}
559 Gets the full (default) or abbreviated (specify
{\tt Name
\_Abbr} name of the
564 \helpref{GetMonthName
}{wxdatetimegetmonthname
}
567 \membersection{wxDateTime::IsLeapYear
}\label{wxdatetimeisleapyear
}
569 \func{static bool
}{IsLeapYear
}{\param{int
}{year = Inv
\_Year},
\param{Calendar
}{cal = Gregorian
}}
571 Returns
{\tt true
} if the
{\it year
} is a leap one in the specified calendar.
573 This functions supports Gregorian and Julian calendars.
576 \membersection{wxDateTime::IsWestEuropeanCountry
}\label{wxdatetimeiswesteuropeancountry
}
578 \func{static bool
}{IsWestEuropeanCountry
}{\param{Country
}{country = Country
\_Default}}
580 This function returns
{\tt true
} if the specified (or default) country is one
581 of Western European ones. It is used internally by wxDateTime to determine the
582 DST convention and date and time formatting rules.
585 \membersection{wxDateTime::IsDSTApplicable
}\label{wxdatetimeisdstapplicable
}
587 \func{static bool
}{IsDSTApplicable
}{\param{int
}{year = Inv
\_Year},
\param{Country
}{country = Country
\_Default}}
589 Returns
{\tt true
} if DST was used n the given year (the current one by
590 default) in the given country.
593 \membersection{wxDateTime::Now
}\label{wxdatetimenow
}
595 \func{static wxDateTime
}{Now
}{\void}
597 Returns the object corresponding to the current time.
602 wxDateTime now = wxDateTime::Now();
603 printf("Current time in Paris:
\t%s\n", now.Format("%c", wxDateTime::CET).c_str());
606 Note that this function is accurate up to second:
607 \helpref{wxDateTime::UNow
}{wxdatetimeunow
} should be used for better precision
608 (but it is less efficient and might not be available on all platforms).
612 \helpref{Today
}{wxdatetimetoday
}
615 \membersection{wxDateTime::SetCountry
}\label{wxdatetimesetcountry
}
617 \func{static void
}{SetCountry
}{\param{Country
}{country
}}
619 Sets the country to use by default. This setting influences the DST
620 calculations, date formatting and other things.
622 The possible values for
{\it country
} parameter are enumerated in
623 \helpref{wxDateTime constants section
}{wxdatetime
}.
627 \helpref{GetCountry
}{wxdatetimegetcountry
}
630 \membersection{wxDateTime::Today
}\label{wxdatetimetoday
}
632 \func{static wxDateTime
}{Today
}{\void}
634 Returns the object corresponding to the midnight of the current day (i.e. the
635 same as
\helpref{Now()
}{wxdatetimenow
}, but the time part is set to $
0$).
639 \helpref{Now
}{wxdatetimenow
}
642 \membersection{wxDateTime::UNow
}\label{wxdatetimeunow
}
644 \func{static wxDateTime
}{UNow
}{\void}
646 Returns the object corresponding to the current time including the
647 milliseconds if a function to get time with such precision is available on the
648 current platform (supported under most Unices and Win32).
652 \helpref{Now
}{wxdatetimenow
}
654 %%%%%%%%%%%%%%%%%%%%%%%%%%% constructors &c %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
657 \membersection{wxDateTime::wxDateTime
}\label{wxdatetimewxdatetimedef
}
659 \func{}{wxDateTime
}{\void}
661 Default constructor. Use one of
{\tt Set()
} functions to initialize the object
665 \membersection{wxDateTime::wxDateTime
}\label{wxdatetimewxdatetimetimet
}
667 \func{wxDateTime\&
}{wxDateTime
}{\param{time
\_t }{timet
}}
669 Same as
\helpref{Set
}{wxdatetimewxdatetimetimet
}.
671 \pythonnote{This constructor is named
{\tt wxDateTimeFromTimeT
} in wxPython.
}
674 \membersection{wxDateTime::wxDateTime
}\label{wxdatetimewxdatetimetm
}
676 \func{wxDateTime\&
}{wxDateTime
}{\param{const struct tm\&
}{tm
}}
678 Same as
\helpref{Set
}{wxdatetimewxdatetimetm
}
680 \pythonnote{Unsupported.
}
683 \membersection{wxDateTime::wxDateTime
}\label{wxdatetimewxdatetimejdn
}
685 \func{wxDateTime\&
}{wxDateTime
}{\param{double
}{jdn
}}
687 Same as
\helpref{Set
}{wxdatetimewxdatetimejdn
}
689 \pythonnote{This constructor is named
{\tt wxDateTimeFromJDN
} in wxPython.
}
692 \membersection{wxDateTime::wxDateTime
}\label{wxdatetimewxdatetimetime
}
694 \func{wxDateTime\&
}{wxDateTime
}{\param{wxDateTime
\_t }{hour
},
\param{wxDateTime
\_t }{minute =
0},
\param{wxDateTime
\_t }{second =
0},
\param{wxDateTime
\_t }{millisec =
0}}
696 Same as
\helpref{Set
}{wxdatetimewxdatetimetime
}
698 \pythonnote{This constructor is named
{\tt wxDateTimeFromHMS
} in wxPython.
}
701 \membersection{wxDateTime::wxDateTime
}\label{wxdatetimewxdatetimedate
}
703 \func{wxDateTime\&
}{wxDateTime
}{\param{wxDateTime
\_t }{day
},
\param{Month
}{month = Inv
\_Month},
\param{int
}{ Inv
\_Year},
704 \param{wxDateTime
\_t }{hour =
0},
\param{wxDateTime
\_t }{minute =
0},
\param{wxDateTime
\_t }{second =
0},
\param{wxDateTime
\_t }{millisec =
0}}
706 Same as
\helpref{Set
}{wxdatetimesetdate
}
708 \pythonnote{This constructor is named
{\tt wxDateTimeFromDMY
} in wxPython.
}
711 \membersection{wxDateTime::SetToCurrent
}\label{wxdatetimesettocurrent
}
713 \func{wxDateTime\&
}{SetToCurrent
}{\void}
715 Sets the date and time of to the current values. Same as assigning the result
716 of
\helpref{Now()
}{wxdatetimenow
} to this object.
719 \membersection{wxDateTime::Set
}\label{wxdatetimesettimet
}
721 \func{wxDateTime\&
}{Set
}{\param{time
\_t }{timet
}}
723 Constructs the object from
{\it timet
} value holding the number of seconds
726 \pythonnote{This method is named
{\tt SetTimeT
} in wxPython.
}
729 \membersection{wxDateTime::Set
}\label{wxdatetimesettm
}
731 \func{wxDateTime\&
}{Set
}{\param{const struct tm\&
}{tm
}}
733 Sets the date and time from the broken down representation in the standard
736 \pythonnote{Unsupported.
}
739 \membersection{wxDateTime::Set
}\label{wxdatetimesetjdn
}
741 \func{wxDateTime\&
}{Set
}{\param{double
}{jdn
}}
743 Sets the date from the so-called
{\it Julian Day Number
}.
745 By definition, the Julian Day Number, usually abbreviated as JDN, of a
746 particular instant is the fractional number of days since
12 hours Universal
747 Coordinated Time (Greenwich mean noon) on January
1 of the year -
4712 in the
748 Julian proleptic calendar.
750 \pythonnote{This method is named
{\tt SetJDN
} in wxPython.
}
753 \membersection{wxDateTime::Set
}\label{wxdatetimesettime
}
755 \func{wxDateTime\&
}{Set
}{\param{wxDateTime
\_t }{hour
},
\param{wxDateTime
\_t }{minute =
0},
\param{wxDateTime
\_t }{second =
0},
\param{wxDateTime
\_t }{millisec =
0}}
757 Sets the date to be equal to
\helpref{Today
}{wxdatetimetoday
} and the time
758 from supplied parameters.
760 \pythonnote{This method is named
{\tt SetHMS
} in wxPython.
}
763 \membersection{wxDateTime::Set
}\label{wxdatetimesetdate
}
765 \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}}
767 Sets the date and time from the parameters.
770 \membersection{wxDateTime::ResetTime
}\label{wxdatetimeresettime
}
772 \func{wxDateTime\&
}{ResetTime
}{\void}
774 Reset time to midnight (
00:
00:
00) without changing the date.
777 \membersection{wxDateTime::SetYear
}\label{wxdatetimesetyear
}
779 \func{wxDateTime\&
}{SetYear
}{\param{int
}{year
}}
781 Sets the year without changing other date components.
784 \membersection{wxDateTime::SetMonth
}\label{wxdatetimesetmonth
}
786 \func{wxDateTime\&
}{SetMonth
}{\param{Month
}{month
}}
788 Sets the month without changing other date components.
791 \membersection{wxDateTime::SetDay
}\label{wxdatetimesetday
}
793 \func{wxDateTime\&
}{SetDay
}{\param{wxDateTime
\_t }{day
}}
795 Sets the day without changing other date components.
798 \membersection{wxDateTime::SetHour
}\label{wxdatetimesethour
}
800 \func{wxDateTime\&
}{SetHour
}{\param{wxDateTime
\_t }{hour
}}
802 Sets the hour without changing other date components.
805 \membersection{wxDateTime::SetMinute
}\label{wxdatetimesetminute
}
807 \func{wxDateTime\&
}{SetMinute
}{\param{wxDateTime
\_t }{minute
}}
809 Sets the minute without changing other date components.
812 \membersection{wxDateTime::SetSecond
}\label{wxdatetimesetsecond
}
814 \func{wxDateTime\&
}{SetSecond
}{\param{wxDateTime
\_t }{second
}}
816 Sets the second without changing other date components.
819 \membersection{wxDateTime::SetMillisecond
}\label{wxdatetimesetmillisecond
}
821 \func{wxDateTime\&
}{SetMillisecond
}{\param{wxDateTime
\_t }{millisecond
}}
823 Sets the millisecond without changing other date components.
826 \membersection{wxDateTime::operator$=$
}\label{wxdatetimeoperatoreqtimet
}
828 \func{wxDateTime\&
}{operator
}{\param{time
\_t }{timet
}}
830 Same as
\helpref{Set
}{wxdatetimesettimet
}.
833 \membersection{wxDateTime::operator$=$
}\label{wxdatetimeoperatoreqtm
}
835 \func{wxDateTime\&
}{operator
}{\param{const struct tm\&
}{tm
}}
837 Same as
\helpref{Set
}{wxdatetimesettm
}.
839 %%%%%%%%%%%%%%%%%%%%%%%%%%% accessors %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
842 \membersection{wxDateTime::IsValid
}\label{wxdatetimeisvalid
}
844 \constfunc{bool
}{IsValid
}{\void}
846 Returns
{\tt true
} if the object represents a valid time moment.
849 \membersection{wxDateTime::GetTm
}\label{wxdatetimegettm
}
851 \constfunc{Tm
}{GetTm
}{\param{const TimeZone\&
}{tz = Local
}}
853 Returns broken down representation of the date and time.
856 \membersection{wxDateTime::GetTicks
}\label{wxdatetimegetticks
}
858 \constfunc{time
\_t}{GetTicks
}{\void}
860 Returns the number of seconds since Jan
1,
1970. An assert failure will occur
861 if the date is not in the range covered by
{\tt time
\_t} type.
864 \membersection{wxDateTime::GetYear
}\label{wxdatetimegetyear
}
866 \constfunc{int
}{GetYear
}{\param{const TimeZone\&
}{tz = Local
}}
868 Returns the year in the given timezone (local one by default).
871 \membersection{wxDateTime::GetMonth
}\label{wxdatetimegetmonth
}
873 \constfunc{Month
}{GetMonth
}{\param{const TimeZone\&
}{tz = Local
}}
875 Returns the month in the given timezone (local one by default).
878 \membersection{wxDateTime::GetDay
}\label{wxdatetimegetday
}
880 \constfunc{wxDateTime
\_t}{GetDay
}{\param{const TimeZone\&
}{tz = Local
}}
882 Returns the day in the given timezone (local one by default).
885 \membersection{wxDateTime::GetWeekDay
}\label{wxdatetimegetweekday
}
887 \constfunc{WeekDay
}{GetWeekDay
}{\param{const TimeZone\&
}{tz = Local
}}
889 Returns the week day in the given timezone (local one by default).
892 \membersection{wxDateTime::GetHour
}\label{wxdatetimegethour
}
894 \constfunc{wxDateTime
\_t}{GetHour
}{\param{const TimeZone\&
}{tz = Local
}}
896 Returns the hour in the given timezone (local one by default).
899 \membersection{wxDateTime::GetMinute
}\label{wxdatetimegetminute
}
901 \constfunc{wxDateTime
\_t}{GetMinute
}{\param{const TimeZone\&
}{tz = Local
}}
903 Returns the minute in the given timezone (local one by default).
906 \membersection{wxDateTime::GetSecond
}\label{wxdatetimegetsecond
}
908 \constfunc{wxDateTime
\_t}{GetSecond
}{\param{const TimeZone\&
}{tz = Local
}}
910 Returns the seconds in the given timezone (local one by default).
913 \membersection{wxDateTime::GetMillisecond
}\label{wxdatetimegetmillisecond
}
915 \constfunc{wxDateTime
\_t}{GetMillisecond
}{\param{const TimeZone\&
}{tz = Local
}}
917 Returns the milliseconds in the given timezone (local one by default).
920 \membersection{wxDateTime::GetDayOfYear
}\label{wxdatetimegetdayofyear
}
922 \constfunc{wxDateTime
\_t}{GetDayOfYear
}{\param{const TimeZone\&
}{tz = Local
}}
924 Returns the day of the year (in $
1\ldots366$ range) in the given timezone
925 (local one by default).
928 \membersection{wxDateTime::GetWeekOfYear
}\label{wxdatetimegetweekofyear
}
930 \constfunc{wxDateTime
\_t}{GetWeekOfYear
}{\param{WeekFlags
}{flags = Monday
\_First},
\param{const TimeZone\&
}{tz = Local
}}
932 Returns the number of the week of the year this date is in. The first week of
933 the year is, according to international standards, the one containing Jan
4 or,
934 equivalently, the first week which has Thursday in this year. Both of these
935 definitions are the same as saying that the first week of the year must contain
936 more than half of its days in this year. Accordingly, the week number will
937 always be in $
1\ldots53$ range ($
52$ for non leap years).
939 The function depends on the
\helpref{week start
}{wxdatetime
} convention
940 specified by the
{\it flags
} argument but its results for
941 \texttt{Sunday
\_First} are not well-defined as the ISO definition quoted above
942 applies to the weeks starting on Monday only.
945 \membersection{wxDateTime::GetWeekOfMonth
}\label{wxdatetimegetweekofmonth
}
947 \constfunc{wxDateTime
\_t}{GetWeekOfMonth
}{\param{WeekFlags
}{flags = Monday
\_First},
\param{const TimeZone\&
}{tz = Local
}}
949 Returns the ordinal number of the week in the month (in $
1\ldots5$ range).
951 As
\helpref{GetWeekOfYear
}{wxdatetimegetweekofyear
}, this function supports
952 both conventions for the week start. See the description of these
953 \helpref{week start
}{wxdatetime
} conventions.
956 \membersection{wxDateTime::IsWorkDay
}\label{wxdatetimeisworkday
}
958 \constfunc{bool
}{IsWorkDay
}{\param{Country
}{country = Country
\_Default}}
960 Returns
{\tt true
} is this day is not a holiday in the given country.
963 \membersection{wxDateTime::IsGregorianDate
}\label{wxdatetimeisgregoriandate
}
965 \constfunc{bool
}{IsGregorianDate
}{\param{GregorianAdoption
}{country = Gr
\_Standard}}
967 Returns
{\tt true
} if the given date is later than the date of adoption of the
968 Gregorian calendar in the given country (and hence the Gregorian calendar
969 calculations make sense for it).
971 %%%%%%%%%%%%%%%%%%%%%% dos date and time format %%%%%%%%%%%%%%%%%%%%%%%
974 \membersection{wxDateTime::SetFromDOS
}\label{wxdatetimesetfromdos
}
976 \func{wxDateTime\&
}{Set
}{\param{unsigned long
}{ddt
}}
978 Sets the date from the date and time in
979 \urlref{DOS
}{http://developer.novell.com/ndk/doc/smscomp/index.html?page=/ndk/doc/smscomp/sms
\_docs/data/hc2vlu5i.html
}
983 \membersection{wxDateTime::GetAsDOS
}\label{wxdatetimegetasdos
}
985 \constfunc{unsigned long
}{GetAsDOS
}{\void}
987 Returns the date and time in
988 \urlref{DOS
}{http://developer.novell.com/ndk/doc/smscomp/index.html?page=/ndk/doc/smscomp/sms
\_docs/data/hc2vlu5i.html
}
991 %%%%%%%%%%%%%%%%%%%%%%%%%%% comparison %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
994 \membersection{wxDateTime::IsEqualTo
}\label{wxdatetimeisequalto
}
996 \constfunc{bool
}{IsEqualTo
}{\param{const wxDateTime\&
}{datetime
}}
998 Returns
{\tt true
} if the two dates are strictly identical.
1001 \membersection{wxDateTime::IsEarlierThan
}\label{wxdatetimeisearlierthan
}
1003 \constfunc{bool
}{IsEarlierThan
}{\param{const wxDateTime\&
}{datetime
}}
1005 Returns
{\tt true
} if this date precedes the given one.
1008 \membersection{wxDateTime::IsLaterThan
}\label{wxdatetimeislaterthan
}
1010 \constfunc{bool
}{IsLaterThan
}{\param{const wxDateTime\&
}{datetime
}}
1012 Returns
{\tt true
} if this date is later than the given one.
1015 \membersection{wxDateTime::IsStrictlyBetween
}\label{wxdatetimeisstrictlybetween
}
1017 \constfunc{bool
}{IsStrictlyBetween
}{\param{const wxDateTime\&
}{t1
},
\param{const wxDateTime\&
}{t2
}}
1019 Returns
{\tt true
} if this date lies strictly between the two others,
1021 \wxheading{See also
}
1023 \helpref{IsBetween
}{wxdatetimeisbetween
}
1026 \membersection{wxDateTime::IsBetween
}\label{wxdatetimeisbetween
}
1028 \constfunc{bool
}{IsBetween
}{\param{const wxDateTime\&
}{t1
},
\param{const wxDateTime\&
}{t2
}}
1030 Returns
{\tt true
} if
\helpref{IsStrictlyBetween
}{wxdatetimeisstrictlybetween
}
1031 is
{\tt true
} or if the date is equal to one of the limit values.
1033 \wxheading{See also
}
1035 \helpref{IsStrictlyBetween
}{wxdatetimeisstrictlybetween
}
1038 \membersection{wxDateTime::IsSameDate
}\label{wxdatetimeissamedate
}
1040 \constfunc{bool
}{IsSameDate
}{\param{const wxDateTime\&
}{dt
}}
1042 Returns
{\tt true
} if the date is the same without comparing the time parts.
1045 \membersection{wxDateTime::IsSameTime
}\label{wxdatetimeissametime
}
1047 \constfunc{bool
}{IsSameTime
}{\param{const wxDateTime\&
}{dt
}}
1049 Returns
{\tt true
} if the time is the same (although dates may differ).
1052 \membersection{wxDateTime::IsEqualUpTo
}\label{wxdatetimeisequalupto
}
1054 \constfunc{bool
}{IsEqualUpTo
}{\param{const wxDateTime\&
}{dt
},
\param{const wxTimeSpan\&
}{ts
}}
1056 Returns
{\tt true
} if the date is equal to another one up to the given time
1057 interval, i.e. if the absolute difference between the two dates is less than
1060 %%%%%%%%%%%%%%%%%%%%%%%%%%% arithmetics %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1063 \membersection{wxDateTime::Add
}\label{wxdatetimeaddts
}
1065 \constfunc{wxDateTime
}{Add
}{\param{const wxTimeSpan\&
}{diff
}}
1067 \func{wxDateTime\&
}{Add
}{\param{const wxTimeSpan\&
}{diff
}}
1069 \func{wxDateTime\&
}{operator$+=$
}{\param{const wxTimeSpan\&
}{diff
}}
1071 Adds the given time span to this object.
1073 \pythonnote{This method is named
{\tt AddTS
} in wxPython.
}
1077 \membersection{wxDateTime::Add
}\label{wxdatetimeaddds
}
1079 \constfunc{wxDateTime
}{Add
}{\param{const wxDateSpan\&
}{diff
}}
1081 \func{wxDateTime\&
}{Add
}{\param{const wxDateSpan\&
}{diff
}}
1083 \func{wxDateTime\&
}{operator$+=$
}{\param{const wxDateSpan\&
}{diff
}}
1085 Adds the given date span to this object.
1087 \pythonnote{This method is named
{\tt AddDS
} in wxPython.
}
1091 \membersection{wxDateTime::Subtract
}\label{wxdatetimesubtractts
}
1093 \constfunc{wxDateTime
}{Subtract
}{\param{const wxTimeSpan\&
}{diff
}}
1095 \func{wxDateTime\&
}{Subtract
}{\param{const wxTimeSpan\&
}{diff
}}
1097 \func{wxDateTime\&
}{operator$-=$
}{\param{const wxTimeSpan\&
}{diff
}}
1099 Subtracts the given time span from this object.
1101 \pythonnote{This method is named
{\tt SubtractTS
} in wxPython.
}
1105 \membersection{wxDateTime::Subtract
}\label{wxdatetimesubtractds
}
1107 \constfunc{wxDateTime
}{Subtract
}{\param{const wxDateSpan\&
}{diff
}}
1109 \func{wxDateTime\&
}{Subtract
}{\param{const wxDateSpan\&
}{diff
}}
1111 \func{wxDateTime\&
}{operator$-=$
}{\param{const wxDateSpan\&
}{diff
}}
1113 Subtracts the given date span from this object.
1115 \pythonnote{This method is named
{\tt SubtractDS
} in wxPython.
}
1119 \membersection{wxDateTime::Subtract
}\label{wxdatetimesubtractdt
}
1121 \constfunc{wxTimeSpan
}{Subtract
}{\param{const wxDateTime\&
}{dt
}}
1123 Subtracts another date from this one and returns the difference between them
1126 %%%%%%%%%%%%%%%%%%%%%%%%%%% parsing/formatting %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1129 \membersection{wxDateTime::ParseRfc822Date
}\label{wxdatetimeparserfc822date
}
1131 \func{const wxChar *
}{ParseRfc822Date
}{\param{const wxChar*
}{date
}}
1133 Parses the string
{\it date
} looking for a date formatted according to the RFC
1134 822 in it. The exact description of this format may, of course, be found in
1135 the RFC (section $
5$), but, briefly, this is the format used in the headers of
1136 Internet email messages and one of the most common strings expressing date in
1137 this format may be something like
{\tt "Sat,
18 Dec
1999 00:
48:
30 +
0100"
}.
1139 Returns
{\tt NULL
} if the conversion failed, otherwise return the pointer to
1140 the character immediately following the part of the string which could be
1141 parsed. If the entire string contains only the date in RFC
822 format,
1142 the returned pointer will be pointing to a
{\tt NUL
} character.
1144 This function is intentionally strict, it will return an error for any string
1145 which is not RFC
822 compliant. If you need to parse date formatted in more
1146 free ways, you should use
\helpref{ParseDateTime
}{wxdatetimeparsedatetime
} or
1147 \helpref{ParseDate
}{wxdatetimeparsedate
} instead.
1150 \membersection{wxDateTime::ParseFormat
}\label{wxdatetimeparseformat
}
1152 \func{const wxChar *
}{ParseFormat
}{\param{const wxChar *
}{date
},
\param{const wxChar *
}{format = wxDefaultDateTimeFormat
},
\param{const wxDateTime\&
}{dateDef = wxDefaultDateTime
}}
1154 This function parses the string
{\it date
} according to the given
1155 {\it format
}. The system
{\tt strptime(
3)
} function is used whenever available,
1156 but even if it is not, this function is still implemented, although support
1157 for locale-dependent format specifiers such as
{\tt "\%c"
},
{\tt "\%x"
} or
{\tt "\%X"
} may
1158 not be perfect and GNU extensions such as
{\tt "\%z"
} and
{\tt "\%Z"
} are
1159 not implemented. This function does handle the month and weekday
1160 names in the current locale on all platforms, however.
1162 Please see the description of the ANSI C function
{\tt strftime(
3)
} for the syntax
1163 of the format string.
1165 The
{\it dateDef
} parameter is used to fill in the fields which could not be
1166 determined from the format string. For example, if the format is
{\tt "\%d"
} (the
1167 ay of the month), the month and the year are taken from
{\it dateDef
}. If
1168 it is not specified,
\helpref{Today
}{wxdatetimetoday
} is used as the
1171 Returns
{\tt NULL
} if the conversion failed, otherwise return the pointer to
1172 the character which stopped the scan.
1175 \membersection{wxDateTime::ParseDateTime
}\label{wxdatetimeparsedatetime
}
1177 \func{const wxChar *
}{ParseDateTime
}{\param{const wxChar *
}{datetime
}}
1179 Parses the string
{\it datetime
} containing the date and time in free format.
1180 This function tries as hard as it can to interpret the given string as date
1181 and time. Unlike
\helpref{ParseRfc822Date
}{wxdatetimeparserfc822date
}, it
1182 will accept anything that may be accepted and will only reject strings which
1183 can not be parsed in any way at all.
1185 Returns
{\tt NULL
} if the conversion failed, otherwise return the pointer to
1186 the character which stopped the scan. This method is currently not
1187 implemented, so always returns NULL.
1190 \membersection{wxDateTime::ParseDate
}\label{wxdatetimeparsedate
}
1192 \func{const wxChar *
}{ParseDate
}{\param{const wxChar *
}{date
}}
1194 This function is like
\helpref{ParseDateTime
}{wxdatetimeparsedatetime
}, but it
1195 only allows the date to be specified. It is thus less flexible then
1196 \helpref{ParseDateTime
}{wxdatetimeparsedatetime
}, but also has less chances to
1197 misinterpret the user input.
1199 Returns
{\tt NULL
} if the conversion failed, otherwise return the pointer to
1200 the character which stopped the scan.
1203 \membersection{wxDateTime::ParseTime
}\label{wxdatetimeparsetime
}
1205 \func{const wxChar *
}{ParseTime
}{\param{const wxChar *
}{time
}}
1207 This functions is like
\helpref{ParseDateTime
}{wxdatetimeparsedatetime
}, but
1208 only allows the time to be specified in the input string.
1210 Returns
{\tt NULL
} if the conversion failed, otherwise return the pointer to
1211 the character which stopped the scan.
1214 \membersection{wxDateTime::Format
}\label{wxdatetimeformat
}
1216 \constfunc{wxString
}{Format
}{\param{const wxChar *
}{format = wxDefaultDateTimeFormat
},
\param{const TimeZone\&
}{tz = Local
}}
1218 This function does the same as the standard ANSI C
{\tt strftime(
3)
} function.
1219 Please see its description for the meaning of
{\it format
} parameter.
1221 It also accepts a few wxWidgets-specific extensions: you can optionally specify
1222 the width of the field to follow using
{\tt printf(
3)
}-like syntax and the
1223 format specification
{\tt \%l
} can be used to get the number of milliseconds.
1225 \wxheading{See also
}
1227 \helpref{ParseFormat
}{wxdatetimeparseformat
}
1230 \membersection{wxDateTime::FormatDate
}\label{wxdatetimeformatdate
}
1232 \constfunc{wxString
}{FormatDate
}{\void}
1234 Identical to calling
\helpref{Format()
}{wxdatetimeformat
} with
{\tt "\%x"
}
1235 argument (which means `preferred date representation for the current locale').
1238 \membersection{wxDateTime::FormatTime
}\label{wxdatetimeformattime
}
1240 \constfunc{wxString
}{FormatTime
}{\void}
1242 Identical to calling
\helpref{Format()
}{wxdatetimeformat
} with
{\tt "\%X"
}
1243 argument (which means `preferred time representation for the current locale').
1246 \membersection{wxDateTime::FormatISODate
}\label{wxdatetimeformatisodate
}
1248 \constfunc{wxString
}{FormatISODate
}{\void}
1250 This function returns the date representation in the ISO
8601 format
1254 \membersection{wxDateTime::FormatISOTime
}\label{wxdatetimeformatisotime
}
1256 \constfunc{wxString
}{FormatISOTime
}{\void}
1258 This function returns the time representation in the ISO
8601 format
1261 %%%%%%%%%%%%%%%%%%%%%%%%%%% calendar calculations %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1264 \membersection{wxDateTime::SetToWeekDayInSameWeek
}\label{wxdatetimesettoweekdayinsameweek
}
1266 \func{wxDateTime\&
}{SetToWeekDayInSameWeek
}{\param{WeekDay
}{weekday
},
\param{WeekFlags
}{flags =
{\tt Monday
\_First}}}
1268 Adjusts the date so that it will still lie in the same week as before, but its
1269 week day will be the given one.
1271 Returns the reference to the modified object itself.
1274 \membersection{wxDateTime::GetWeekDayInSameWeek
}\label{wxdatetimegetweekdayinsameweek
}
1276 \constfunc{wxDateTime
}{GetWeekDayInSameWeek
}{\param{WeekDay
}{weekday
},
\param{WeekFlags
}{flags =
{\tt Monday
\_First}}}
1278 Returns the copy of this object to which
1279 \helpref{SetToWeekDayInSameWeek
}{wxdatetimesettoweekdayinsameweek
} was
1283 \membersection{wxDateTime::SetToNextWeekDay
}\label{wxdatetimesettonextweekday
}
1285 \func{wxDateTime\&
}{SetToNextWeekDay
}{\param{WeekDay
}{weekday
}}
1287 Sets the date so that it will be the first
{\it weekday
} following the current
1290 Returns the reference to the modified object itself.
1293 \membersection{wxDateTime::GetNextWeekDay
}\label{wxdatetimegetnextweekday
}
1295 \constfunc{wxDateTime
}{GetNextWeekDay
}{\param{WeekDay
}{weekday
}}
1297 Returns the copy of this object to which
1298 \helpref{SetToNextWeekDay
}{wxdatetimesettonextweekday
} was applied.
1301 \membersection{wxDateTime::SetToPrevWeekDay
}\label{wxdatetimesettoprevweekday
}
1303 \func{wxDateTime\&
}{SetToPrevWeekDay
}{\param{WeekDay
}{weekday
}}
1305 Sets the date so that it will be the last
{\it weekday
} before the current
1308 Returns the reference to the modified object itself.
1311 \membersection{wxDateTime::GetPrevWeekDay
}\label{wxdatetimegetprevweekday
}
1313 \constfunc{wxDateTime
}{GetPrevWeekDay
}{\param{WeekDay
}{weekday
}}
1315 Returns the copy of this object to which
1316 \helpref{SetToPrevWeekDay
}{wxdatetimesettoprevweekday
} was applied.
1319 \membersection{wxDateTime::SetToWeekDay
}\label{wxdatetimesettoweekday
}
1321 \func{bool
}{SetToWeekDay
}{\param{WeekDay
}{weekday
},
\param{int
}{n =
1},
\param{Month
}{month = Inv
\_Month},
\param{int
}{year = Inv
\_Year}}
1323 Sets the date to the
{\it n
}-th
{\it weekday
} in the given month of the given
1324 year (the current month and year are used by default). The parameter
{\it n
}
1325 may be either positive (counting from the beginning of the month) or negative
1326 (counting from the end of it).
1328 For example,
{\tt SetToWeekDay(
2, wxDateTime::Wed)
} will set the date to the
1329 second Wednesday in the current month and
1330 {\tt SetToWeekDay(-
1, wxDateTime::Sun)
} -- to the last Sunday in it.
1332 Returns
{\tt true
} if the date was modified successfully,
{\tt false
}
1333 otherwise meaning that the specified date doesn't exist.
1336 \membersection{wxDateTime::GetWeekDay
}\label{wxdatetimegetweekday2
}
1338 \constfunc{wxDateTime
}{GetWeekDay
}{\param{WeekDay
}{weekday
},
\param{int
}{n =
1},
\param{Month
}{month = Inv
\_Month},
\param{int
}{year = Inv
\_Year}}
1340 Returns the copy of this object to which
1341 \helpref{SetToWeekDay
}{wxdatetimesettoweekday
} was applied.
1344 \membersection{wxDateTime::SetToLastWeekDay
}\label{wxdatetimesettolastweekday
}
1346 \func{bool
}{SetToLastWeekDay
}{\param{WeekDay
}{weekday
},
\param{Month
}{month = Inv
\_Month},
\param{int
}{year = Inv
\_Year}}
1348 The effect of calling this function is the same as of calling
1349 {\tt SetToWeekDay(-
1, weekday, month, year)
}. The date will be set to the last
1350 {\it weekday
} in the given month and year (the current ones by default).
1352 Always returns
{\tt true
}.
1355 \membersection{wxDateTime::GetLastWeekDay
}\label{wxdatetimegetlastweekday
}
1357 \func{wxDateTime
}{GetLastWeekDay
}{\param{WeekDay
}{weekday
},
\param{Month
}{month = Inv
\_Month},
\param{int
}{year = Inv
\_Year}}
1359 Returns the copy of this object to which
1360 \helpref{SetToLastWeekDay
}{wxdatetimesettolastweekday
} was applied.
1363 \membersection{wxDateTime::SetToWeekOfYear
}\label{wxdatetimesettoweekofyear
}
1365 \func{static wxDateTime
}{SetToWeekOfYear
}{\param{int
}{year
},
\param{wxDateTime
\_t }{numWeek
},
\param{WeekDay
}{weekday = Mon
}}
1367 Set the date to the given
\arg{weekday
} in the week number
\arg{numWeek
} of the
1368 given
\arg{year
} . The number should be in range $
1\ldots53$.
1370 Note that the returned date may be in a different year than the one passed to
1371 this function because both the week $
1$ and week $
52$ or $
53$ (for leap years)
1372 contain days from different years. See
1373 \helpref{GetWeekOfYear
}{wxdatetimegetweekofyear
} for the explanation of how the
1374 year weeks are counted.
1377 \membersection{wxDateTime::SetToLastMonthDay
}\label{wxdatetimesettolastmonthday
}
1379 \func{wxDateTime\&
}{SetToLastMonthDay
}{\param{Month
}{month = Inv
\_Month},
\param{int
}{year = Inv
\_Year}}
1381 Sets the date to the last day in the specified month (the current one by
1384 Returns the reference to the modified object itself.
1387 \membersection{wxDateTime::GetLastMonthDay
}\label{wxdatetimegetlastmonthday
}
1389 \constfunc{wxDateTime
}{GetLastMonthDay
}{\param{Month
}{month = Inv
\_Month},
\param{int
}{year = Inv
\_Year}}
1391 Returns the copy of this object to which
1392 \helpref{SetToLastMonthDay
}{wxdatetimesettolastmonthday
} was applied.
1395 \membersection{wxDateTime::SetToYearDay
}\label{wxdatetimesettoyearday
}
1397 \func{wxDateTime\&
}{SetToYearDay
}{\param{wxDateTime
\_t }{yday
}}
1399 Sets the date to the day number
{\it yday
} in the same year (i.e., unlike the
1400 other functions, this one does not use the current year). The day number
1401 should be in the range $
1\ldots366$ for the leap years and $
1\ldots365$ for
1404 Returns the reference to the modified object itself.
1407 \membersection{wxDateTime::GetYearDay
}\label{wxdatetimegetyearday
}
1409 \constfunc{wxDateTime
}{GetYearDay
}{\param{wxDateTime
\_t }{yday
}}
1411 Returns the copy of this object to which
1412 \helpref{SetToYearDay
}{wxdatetimesettoyearday
} was applied.
1414 %%%%%%%%%%%%%%%%%%%%%%%%%%% astronomical functions %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1417 \membersection{wxDateTime::GetJulianDayNumber
}\label{wxdatetimegetjuliandaynumber
}
1419 \constfunc{double
}{GetJulianDayNumber
}{\void}
1421 Returns the
\helpref{JDN
}{wxdatetimesetjdn
} corresponding to this date. Beware
1424 \wxheading{See also
}
1426 \helpref{GetModifiedJulianDayNumber
}{wxdatetimegetmodifiedjuliandaynumber
}
1429 \membersection{wxDateTime::GetJDN
}\label{wxdatetimegetjdn
}
1431 \constfunc{double
}{GetJDN
}{\void}
1433 Synonym for
\helpref{GetJulianDayNumber
}{wxdatetimegetjuliandaynumber
}.
1436 \membersection{wxDateTime::GetModifiedJulianDayNumber
}\label{wxdatetimegetmodifiedjuliandaynumber
}
1438 \constfunc{double
}{GetModifiedJulianDayNumber
}{\void}
1440 Returns the
{\it Modified Julian Day Number
} (MJD) which is, by definition,
1441 equal to $JDN -
2400000.5$. The MJDs are simpler to work with as the integral
1442 MJDs correspond to midnights of the dates in the Gregorian calendar and not th
1443 noons like JDN. The MJD $
0$ is Nov
17,
1858.
1446 \membersection{wxDateTime::GetMJD
}\label{wxdatetimegetmjd
}
1448 \constfunc{double
}{GetMJD
}{\void}
1450 Synonym for
\helpref{GetModifiedJulianDayNumber
}{wxdatetimegetmodifiedjuliandaynumber
}.
1453 \membersection{wxDateTime::GetRataDie
}\label{wxdatetimegetratadie
}
1455 \constfunc{double
}{GetRataDie
}{\void}
1457 Return the
{\it Rata Die number
} of this date.
1459 By definition, the Rata Die number is a date specified as the number of days
1460 relative to a base date of December
31 of the year
0. Thus January
1 of the
1461 year
1 is Rata Die day
1.
1463 %%%%%%%%%%%%%%%%%%%%%%%%%%% timezone and DST %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1466 \membersection{wxDateTime::FromTimezone
}\label{wxdatetimefromtimezone
}
1468 \constfunc{wxDateTime
}{FromTimezone
}{\param{const TimeZone\&
}{tz
},
\param{bool
}{noDST = false
}}
1470 Transform the date from the given time zone to the local one. If
{\it noDST
} is
1471 {\tt true
}, no DST adjustments will be made.
1473 Returns the date in the local time zone.
1476 \membersection{wxDateTime::ToTimezone
}\label{wxdatetimetotimezone
}
1478 \constfunc{wxDateTime
}{ToTimezone
}{\param{const TimeZone\&
}{tz
},
\param{bool
}{noDST = false
}}
1480 Transform the date to the given time zone. If
{\it noDST
} is
{\tt true
}, no
1481 DST adjustments will be made.
1483 Returns the date in the new time zone.
1486 \membersection{wxDateTime::MakeTimezone
}\label{wxdatetimemaketimezone
}
1488 \func{wxDateTime\&
}{MakeTimezone
}{\param{const TimeZone\&
}{tz
},
\param{bool
}{noDST = false
}}
1490 Modifies the object in place to represent the date in another time zone. If
1491 {\it noDST
} is
{\tt true
}, no DST adjustments will be made.
1494 \membersection{wxDateTime::MakeFromTimezone
}\label{wxdatetimemakefromtimezone
}
1496 \func{wxDateTime\&
}{MakeFromTimezone
}{\param{const TimeZone\&
}{tz
},
\param{bool
}{noDST = false
}}
1498 Same as
\helpref{FromTimezone
}{wxdatetimefromtimezone
} but modifies the object
1502 \membersection{wxDateTime::ToUTC
}\label{wxdatetimetoutc
}
1504 \constfunc{wxDateTime
}{ToUTC
}{\param{bool
}{noDST = false
}}
1506 This is the same as calling
\helpref{ToTimezone
}{wxdatetimetotimezone
} with
1507 the argument
{\tt GMT0
}.
1510 \membersection{wxDateTime::MakeUTC
}\label{wxdatetimemakeutc
}
1512 \func{wxDateTime\&
}{MakeUTC
}{\param{bool
}{noDST = false
}}
1514 This is the same as calling
\helpref{MakeTimezone
}{wxdatetimemaketimezone
} with
1515 the argument
{\tt GMT0
}.
1518 \membersection{wxDateTime::IsDST
}\label{wxdatetimeisdst
}
1520 \constfunc{int
}{IsDST
}{\param{Country
}{country = Country
\_Default}}
1522 Returns
{\tt true
} if the DST is applied for this date in the given country.
1524 \wxheading{See also
}
1526 \helpref{GetBeginDST
}{wxdatetimegetbegindst
} and
1527 \helpref{GetEndDST
}{wxdatetimegetenddst
}
1529 \section{\class{wxDateTimeHolidayAuthority
}}\label{wxdatetimeholidayauthority
}
1533 \section{\class{wxDateTimeWorkDays
}}\label{wxdatetimeworkdays
}