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, GMT13,
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 = GMT13 +
1, // Central Standard Time (+
9.5)
81 A_EST = GMT10, // Eastern Standard Time
82 A_ESST = GMT11, // Eastern Summer Time
85 NZST = GMT12, // Standard Time
86 NZDT = GMT13, // Daylight Saving Time
88 // Universal Coordinated Time = the new and politically correct name
94 Month names: Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec and
95 Inv
\_Month for an invalid.month value are the values of
{\tt wxDateTime::Month
}
98 Likewise, Sun, Mon, Tue, Wed, Thu, Fri, Sat, and Inv
\_WeekDay are the values in
99 {\tt wxDateTime::WeekDay
} enum.
101 Finally, Inv
\_Year is defined to be an invalid value for year parameter.
103 \helpref{GetMonthName()
}{wxdatetimegetmonthname
} and
104 \helpref{GetWeekDayName
}{wxdatetimegetweekdayname
} functions use the following
110 Name_Full =
0x01, // return full name
111 Name_Abbr =
0x02 // return abbreviated name
115 Several functions accept an extra parameter specifying the calendar to use
116 (although most of them only support now the Gregorian calendar). This
117 parameters is one of the following values:
122 Gregorian, // calendar currently in use in Western countries
123 Julian // calendar in use since -
45 until the
1582 (or later)
127 Date calculations often depend on the country and wxDateTime allows to set the
128 country whose conventions should be used using
129 \helpref{SetCountry
}{wxdatetimesetcountry
}. It takes one of the following
135 Country_Unknown, // no special information for this country
136 Country_Default, // set the default country with SetCountry() method
137 // or use the default country with any other
139 Country_WesternEurope_Start,
140 Country_EEC = Country_WesternEurope_Start,
144 Country_WesternEurope_End = UK,
152 Different parts of the world use different conventions for the week start.
153 In some countries, the week starts on Sunday, while in others -- on Monday.
154 The ISO standard doesn't address this issue, so we support both conventions in
155 the functions whose result depends on it (
\helpref{GetWeekOfYear
}{wxdatetimegetweekofyear
} and
156 \helpref{GetWeekOfMonth
}{wxdatetimegetweekofmonth
}).
158 The desired behvaiour may be specified by giving one of the following
159 constants as argument to these functions:
164 Default_First, // Sunday_First for US, Monday_First for the rest
165 Monday_First, // week starts with a Monday
166 Sunday_First // week starts with a Sunday
170 \wxheading{Derived from
}
174 \wxheading{Include files
}
180 \helpref{wxBase
}{librarieslist
}
184 \helpref{Date classes overview
}{wxdatetimeoverview
},
\rtfsp
185 \helpref{wxTimeSpan
}{wxtimespan
},
\rtfsp
186 \helpref{wxDateSpan
}{wxdatespan
},
\rtfsp
187 \helpref{wxCalendarCtrl
}{wxcalendarctrl
}
189 \latexignore{\rtfignore{\wxheading{Function groups
}}}
192 \membersection{Static functions
}\label{datetimestaticfunctions
}
194 For convenience, all static functions are collected here. These functions
195 either set or return the static variables of wxDateSpan (the country), return
196 the current moment, year, month or number of days in it, or do some general
197 calendar-related actions.
199 Please note that although several function accept an extra
{\it Calendar
}
200 parameter, it is currently ignored as only the Gregorian calendar is
201 supported. Future versions will support other calendars.
203 \pythonnote{These methods are standalone functions named
204 {\tt wxDateTime
\_<StaticMethodName>
} in wxPython.
}
206 \helpref{SetCountry
}{wxdatetimesetcountry
}\\
207 \helpref{GetCountry
}{wxdatetimegetcountry
}\\
208 \helpref{IsWestEuropeanCountry
}{wxdatetimeiswesteuropeancountry
}\\
209 \helpref{GetCurrentYear
}{wxdatetimegetcurrentyear
}\\
210 \helpref{ConvertYearToBC
}{wxdatetimeconvertyeartobc
}\\
211 \helpref{GetCurrentMonth
}{wxdatetimegetcurrentmonth
}\\
212 \helpref{IsLeapYear
}{wxdatetimeisleapyear
}\\
213 \helpref{GetCentury
}{wxdatetimegetcenturystatic
}\\
214 \helpref{GetNumberOfDays
}{wxdatetimegetnumberofdays
}\\
215 \helpref{GetNumberOfDays
}{wxdatetimegetnumberofdays
}\\
216 \helpref{GetMonthName
}{wxdatetimegetmonthname
}\\
217 \helpref{GetWeekDayName
}{wxdatetimegetweekdayname
}\\
218 \helpref{GetAmPmStrings
}{wxdatetimegetampmstrings
}\\
219 \helpref{IsDSTApplicable
}{wxdatetimeisdstapplicable
}\\
220 \helpref{GetBeginDST
}{wxdatetimegetbegindst
}\\
221 \helpref{GetEndDST
}{wxdatetimegetenddst
}\\
222 \helpref{Now
}{wxdatetimenow
}\\
223 \helpref{UNow
}{wxdatetimeunow
}\\
224 \helpref{Today
}{wxdatetimetoday
}
227 \membersection{Constructors, assignment operators and setters
}\label{datetimeconstructors
}
229 Constructors and various
{\tt Set()
} methods are collected here. If you
230 construct a date object from separate values for day, month and year, you
231 should use
\helpref{IsValid
}{wxdatetimeisvalid
} method to check that the
232 values were correct as constructors can not return an error code.
234 \helpref{wxDateTime()
}{wxdatetimewxdatetimedef
}\\
235 \helpref{wxDateTime(time
\_t)
}{wxdatetimewxdatetimetimet
}\\
236 \helpref{wxDateTime(struct tm)
}{wxdatetimewxdatetimetm
}\\
237 %\helpref{wxDateTime(struct Tm)}{wxdatetimewxdatetimetm} - Tm not documented yet\\
238 \helpref{wxDateTime(double jdn)
}{wxdatetimewxdatetimejdn
}\\
239 \helpref{wxDateTime(h, m, s, ms)
}{wxdatetimewxdatetimetime
}\\
240 \helpref{wxDateTime(day, mon, year, h, m, s, ms)
}{wxdatetimewxdatetimedate
}\\
241 \helpref{SetToCurrent
}{wxdatetimesettocurrent
}\\
242 \helpref{Set(time
\_t)
}{wxdatetimesettimet
}\\
243 \helpref{Set(struct tm)
}{wxdatetimesettm
}\\
244 %\helpref{Set(struct Tm)}{wxdatetimesettm} - Tm not documented yet\\
245 \helpref{Set(double jdn)
}{wxdatetimesetjdn
}\\
246 \helpref{Set(h, m, s, ms)
}{wxdatetimesettime
}\\
247 \helpref{Set(day, mon, year, h, m, s, ms)
}{wxdatetimesetdate
}\\
248 \helpref{SetFromDOS(unsigned long ddt)
}{wxdatetimesetfromdos
}\\
249 \helpref{ResetTime
}{wxdatetimeresettime
}\\
250 \helpref{SetYear
}{wxdatetimesetyear
}\\
251 \helpref{SetMonth
}{wxdatetimesetmonth
}\\
252 \helpref{SetDay
}{wxdatetimesetdate
}\\
253 \helpref{SetHour
}{wxdatetimesethour
}\\
254 \helpref{SetMinute
}{wxdatetimesetminute
}\\
255 \helpref{SetSecond
}{wxdatetimesetsecond
}\\
256 \helpref{SetMillisecond
}{wxdatetimesetmillisecond
}\\
257 \helpref{operator$=$(time
\_t)
}{wxdatetimeoperatoreqtimet
}\\
258 \helpref{operator$=$(struct tm)
}{wxdatetimeoperatoreqtm
}\rtfsp
261 \membersection{Accessors
}\label{datetimeaccessors
}
263 Here are the trivial accessors. Other functions, which might have to perform
264 some more complicated calculations to find the answer are under the
265 \helpref{Calendar calculations
}{datetimecalculations
} section.
267 \helpref{IsValid
}{wxdatetimeisvalid
}\\
268 \helpref{GetTicks
}{wxdatetimegetticks
}\\
269 \helpref{GetCentury
}{wxdatetimegetcentury
}\\
270 \helpref{GetYear
}{wxdatetimegetyear
}\\
271 \helpref{GetMonth
}{wxdatetimegetmonth
}\\
272 \helpref{GetDay
}{wxdatetimegetday
}\\
273 \helpref{GetWeekDay
}{wxdatetimegetweekday
}\\
274 \helpref{GetHour
}{wxdatetimegethour
}\\
275 \helpref{GetMinute
}{wxdatetimegetminute
}\\
276 \helpref{GetSecond
}{wxdatetimegetsecond
}\\
277 \helpref{GetMillisecond
}{wxdatetimegetmillisecond
}\\
278 \helpref{GetDayOfYear
}{wxdatetimegetdayofyear
}\\
279 \helpref{GetWeekOfYear
}{wxdatetimegetweekofyear
}\\
280 \helpref{GetWeekOfMonth
}{wxdatetimegetweekofmonth
}\\
281 \helpref{GetYearDay
}{wxdatetimegetyearday
}\\
282 \helpref{IsWorkDay
}{wxdatetimeisworkday
}\\
283 \helpref{IsGregorianDate
}{wxdatetimeisgregoriandate
}\\
284 \helpref{GetAsDOS
}{wxdatetimegetasdos
}
287 \membersection{Date comparison
}\label{datecomparison
}
289 There are several function to allow date comparison. To supplement them, a few
290 global operators $>$, $<$ etc taking wxDateTime are defined.
292 \helpref{IsEqualTo
}{wxdatetimeisequalto
}\\
293 \helpref{IsEarlierThan
}{wxdatetimeisearlierthan
}\\
294 \helpref{IsLaterThan
}{wxdatetimeislaterthan
}\\
295 \helpref{IsStrictlyBetween
}{wxdatetimeisstrictlybetween
}\\
296 \helpref{IsBetween
}{wxdatetimeisbetween
}\\
297 \helpref{IsSameDate
}{wxdatetimeissamedate
}\\
298 \helpref{IsSameTime
}{wxdatetimeissametime
}\\
299 \helpref{IsEqualUpTo
}{wxdatetimeisequalupto
}
302 \membersection{Date arithmetics
}\label{datearithmetics
}
304 These functions carry out
\helpref{arithmetics
}{tdatearithm
} on the wxDateTime
305 objects. As explained in the overview, either wxTimeSpan or wxDateSpan may be
306 added to wxDateTime, hence all functions are overloaded to accept both
309 Also, both
{\tt Add()
} and
{\tt Subtract()
} have both const and non-const
310 version. The first one returns a new object which represents the
311 sum/difference of the original one with the argument while the second form
312 modifies the object to which it is applied. The operators $-=$ and $+=$ are
313 defined to be equivalent to the second forms of these functions.
315 \helpref{Add(wxTimeSpan)
}{wxdatetimeaddts
}\\
316 \helpref{Add(wxDateSpan)
}{wxdatetimeaddds
}\\
317 \helpref{Subtract(wxTimeSpan)
}{wxdatetimesubtractts
}\\
318 \helpref{Subtract(wxDateSpan)
}{wxdatetimesubtractds
}\\
319 \helpref{Subtract(wxDateTime)
}{wxdatetimesubtractdt
}\\
320 \helpref{oparator$+=$(wxTimeSpan)
}{wxdatetimeaddts
}\\
321 \helpref{oparator$+=$(wxDateSpan)
}{wxdatetimeaddds
}\\
322 \helpref{oparator$-=$(wxTimeSpan)
}{wxdatetimesubtractts
}\\
323 \helpref{oparator$-=$(wxDateSpan)
}{wxdatetimesubtractds
}
326 \membersection{Parsing and formatting dates
}\label{datetimeparsing
}
328 These functions convert wxDateTime objects to and from text. The
329 conversions to text are mostly trivial: you can either do it using the default
330 date and time representations for the current locale (
331 \helpref{FormatDate
}{wxdatetimeformatdate
} and
332 \helpref{FormatTime
}{wxdatetimeformattime
}), using the international standard
333 representation defined by ISO
8601 (
334 \helpref{FormatISODate
}{wxdatetimeformatisodate
},
335 \helpref{FormatISOTime
}{wxdatetimeformatisotime
} and
336 \helpref{FormatISOCombined
}{wxdatetimeformatisocombined
}) or by specifying any
337 format at all and using
\helpref{Format
}{wxdatetimeformat
} directly.
339 The conversions from text are more interesting, as there are much more
340 possibilities to care about. The simplest cases can be taken care of with
341 \helpref{ParseFormat
}{wxdatetimeparseformat
} which can parse any date in the
342 given (rigid) format.
\helpref{ParseRfc822Date
}{wxdatetimeparserfc822date
} is
343 another function for parsing dates in predefined format -- the one of RFC
822
344 which (still...) defines the format of email messages on the Internet. This
345 format can not be described with
{\tt strptime(
3)
}-like format strings used by
346 \helpref{Format
}{wxdatetimeformat
}, hence the need for a separate function.
348 But the most interesting functions are
349 \helpref{ParseTime
}{wxdatetimeparsetime
},
350 \helpref{ParseDate
}{wxdatetimeparsedate
} and
351 \helpref{ParseDateTime
}{wxdatetimeparsedatetime
}. They try to parse the date
352 ans time (or only one of them) in `free' format, i.e. allow them to be
353 specified in any of possible ways. These functions will usually be used to
354 parse the (interactive) user input which is not bound to be in any predefined
355 format. As an example,
\helpref{ParseDateTime
}{wxdatetimeparsedatetime
} can
356 parse the strings such as
{\tt "tomorrow"
},
{\tt "March first"
} and even
359 Finally notice that each of the parsing functions is available in several
360 overloads: if the input string is a narrow (
\texttt{char *
}) string, then a
361 narrow pointer is returned. If the input string is a wide string, a wide char
362 pointer is returned. Finally, if the input parameter is a wxString, a narrow
363 char pointer is also returned for backwards compatibility but there is also an
364 additional argument of wxString::const
\_iterator type in which, if it is not
365 \NULL, an iterator pointing to the end of the scanned string part is returned.
367 \helpref{ParseFormat
}{wxdatetimeparseformat
}\\
368 \helpref{ParseDateTime
}{wxdatetimeparsedatetime
}\\
369 \helpref{ParseDate
}{wxdatetimeparsedate
}\\
370 \helpref{ParseTime
}{wxdatetimeparsetime
}\\
371 \helpref{ParseISODate
}{wxdatetimeparseisodate
}\\
372 \helpref{ParseISOTime
}{wxdatetimeparseisotime
}\\
373 \helpref{ParseISOCombined
}{wxdatetimeparseisocombined
}\\
374 \helpref{ParseRfc822Date
}{wxdatetimeparserfc822date
}\\
375 \helpref{Format
}{wxdatetimeformat
}\\
376 \helpref{FormatDate
}{wxdatetimeformatdate
}\\
377 \helpref{FormatTime
}{wxdatetimeformattime
}\\
378 \helpref{FormatISOCombined
}{wxdatetimeformatisocombined
}\\
379 \helpref{FormatISODate
}{wxdatetimeformatisodate
}\\
380 \helpref{FormatISOTime
}{wxdatetimeformatisotime
}
383 \membersection{Calendar calculations
}\label{datetimecalculations
}
385 The functions in this section perform the basic calendar calculations, mostly
386 related to the week days. They allow to find the given week day in the
387 week with given number (either in the month or in the year) and so on.
389 All (non-const) functions in this section don't modify the time part of the
390 wxDateTime -- they only work with the date part of it.
392 \helpref{SetToWeekDayInSameWeek
}{wxdatetimesettoweekdayinsameweek
}\\
393 \helpref{GetWeekDayInSameWeek
}{wxdatetimegetweekdayinsameweek
}\\
394 \helpref{SetToNextWeekDay
}{wxdatetimesettonextweekday
}\\
395 \helpref{GetNextWeekDay
}{wxdatetimegetnextweekday
}\\
396 \helpref{SetToPrevWeekDay
}{wxdatetimesettoprevweekday
}\\
397 \helpref{GetPrevWeekDay
}{wxdatetimegetprevweekday
}\\
398 \helpref{SetToWeekDay
}{wxdatetimesettoweekday
}\\
399 \helpref{GetWeekDay
}{wxdatetimegetweekday2
}\\
400 \helpref{SetToLastWeekDay
}{wxdatetimesettolastweekday
}\\
401 \helpref{GetLastWeekDay
}{wxdatetimegetlastweekday
}\\
402 \helpref{SetToWeekOfYear
}{wxdatetimesettoweekofyear
}\\
403 \helpref{SetToLastMonthDay
}{wxdatetimesettolastmonthday
}\\
404 \helpref{GetLastMonthDay
}{wxdatetimegetlastmonthday
}\\
405 \helpref{SetToYearDay
}{wxdatetimesettoyearday
}\\
406 \helpref{GetYearDay
}{wxdatetimegetyearday
}
409 \membersection{Astronomical/historical functions
}\label{astronomyhistoryfunctions
}
411 Some degree of support for the date units used in astronomy and/or history is
412 provided. You can construct a wxDateTime object from a
413 \helpref{JDN
}{wxdatetimesetjdn
} and you may also get its JDN,
414 \helpref{MJD
}{wxdatetimegetmodifiedjuliandaynumber
} or
415 \helpref{Rata Die number
}{wxdatetimegetratadie
} from it.
417 \helpref{wxDateTime(double jdn)
}{wxdatetimewxdatetimejdn
}\\
418 \helpref{Set(double jdn)
}{wxdatetimesetjdn
}\\
419 \helpref{GetJulianDayNumber
}{wxdatetimegetjuliandaynumber
}\\
420 \helpref{GetJDN
}{wxdatetimegetjdn
}\\
421 \helpref{GetModifiedJulianDayNumber
}{wxdatetimegetmodifiedjuliandaynumber
}\\
422 \helpref{GetMJD
}{wxdatetimegetmjd
}\\
423 \helpref{GetRataDie
}{wxdatetimegetratadie
}
426 \membersection{Time zone and DST support
}\label{datetimedstzone
}
428 Please see the
\helpref{time zone overview
}{tdatetimezones
} for more
429 information about time zones. Normally, these functions should be rarely used.
431 \helpref{FromTimezone
}{wxdatetimefromtimezone
}\\
432 \helpref{ToTimezone
}{wxdatetimetotimezone
}\\
433 \helpref{MakeTimezone
}{wxdatetimemaketimezone
}\\
434 \helpref{MakeFromTimezone
}{wxdatetimemakefromtimezone
}\\
435 \helpref{ToUTC
}{wxdatetimetoutc
}\\
436 \helpref{MakeUTC
}{wxdatetimemakeutc
}\\
437 \helpref{GetBeginDST
}{wxdatetimegetbegindst
}\\
438 \helpref{GetEndDST
}{wxdatetimegetenddst
}\\
439 \helpref{IsDST
}{wxdatetimeisdst
}
441 \helponly{\insertatlevel{2}{
447 %%%%%%%%%%%%%%%%%%%%%%%%%%% static functions %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
450 \membersection{wxDateTime::ConvertYearToBC
}\label{wxdatetimeconvertyeartobc
}
452 \func{static int
}{ConvertYearToBC
}{\param{int
}{year
}}
454 Converts the year in absolute notation (i.e. a number which can be negative,
455 positive or zero) to the year in BC/AD notation. For the positive years,
456 nothing is done, but the year
0 is year
1 BC and so for other years there is a
459 This function should be used like this:
463 int y = dt.GetYear();
464 printf("The year is
%d%s", wxDateTime::ConvertYearToBC(y), y > 0 ? "AD" : "BC");
468 \membersection{wxDateTime::GetAmPmStrings
}\label{wxdatetimegetampmstrings
}
470 \func{static void
}{GetAmPmStrings
}{\param{wxString *
}{am
},
\param{wxString *
}{pm
}}
472 Returns the translations of the strings
{\tt AM
} and
{\tt PM
} used for time
473 formatting for the current locale. Either of the pointers may be
{\tt NULL
} if
474 the corresponding value is not needed.
477 \membersection{wxDateTime::GetBeginDST
}\label{wxdatetimegetbegindst
}
479 \func{static wxDateTime
}{GetBeginDST
}{\param{int
}{year = Inv
\_Year},
\param{Country
}{country = Country
\_Default}}
481 Get the beginning of DST for the given country in the given year (current one
482 by default). This function suffers from limitations described in
483 \helpref{DST overview
}{tdatedst
}.
487 \helpref{GetEndDST
}{wxdatetimegetenddst
}
490 \membersection{wxDateTime::GetCountry
}\label{wxdatetimegetcountry
}
492 \func{static Country
}{GetCountry
}{\void}
494 Returns the current default country. The default country is used for DST
495 calculations, for example.
499 \helpref{SetCountry
}{wxdatetimesetcountry
}
502 \membersection{wxDateTime::GetCurrentYear
}\label{wxdatetimegetcurrentyear
}
504 \func{static int
}{GetCurrentYear
}{\param{Calendar
}{cal = Gregorian
}}
506 Get the current year in given calendar (only Gregorian is currently supported).
509 \membersection{wxDateTime::GetCurrentMonth
}\label{wxdatetimegetcurrentmonth
}
511 \func{static Month
}{GetCurrentMonth
}{\param{Calendar
}{cal = Gregorian
}}
513 Get the current month in given calendar (only Gregorian is currently supported).
516 \membersection{wxDateTime::GetCentury
}\label{wxdatetimegetcenturystatic
}
518 \func{static int
}{GetCentury
}{\param{int
}{year
}}
520 Get the current century, i.e. first two digits of the year, in given calendar
521 (only Gregorian is currently supported).
524 \membersection{wxDateTime::GetEndDST
}\label{wxdatetimegetenddst
}
526 \func{static wxDateTime
}{GetEndDST
}{\param{int
}{year = Inv
\_Year},
\param{Country
}{country = Country
\_Default}}
528 Returns the end of DST for the given country in the given year (current one by
533 \helpref{GetBeginDST
}{wxdatetimegetbegindst
}
536 \membersection{wxDateTime::GetMonthName
}\label{wxdatetimegetmonthname
}
538 \func{static wxString
}{GetMonthName
}{\param{Month
}{month
},
\param{NameFlags
}{flags = Name
\_Full}}
540 Gets the full (default) or abbreviated (specify
{\tt Name
\_Abbr} name of the
545 \helpref{GetWeekDayName
}{wxdatetimegetweekdayname
}
548 \membersection{wxDateTime::GetNumberOfDays
}\label{wxdatetimegetnumberofdays
}
550 \func{static wxDateTime
\_t}{GetNumberOfDays
}{\param{int
}{year
},
\param{Calendar
}{cal = Gregorian
}}
552 \func{static wxDateTime
\_t}{GetNumberOfDays
}{\param{Month
}{month
},
\param{int
}{year = Inv
\_Year},
\param{Calendar
}{cal = Gregorian
}}
554 Returns the number of days in the given year or in the given month of the
557 The only supported value for
{\it cal
} parameter is currently
{\tt Gregorian
}.
559 \pythonnote{These two methods are named
{\tt GetNumberOfDaysInYear
}
560 and
{\tt GetNumberOfDaysInMonth
} in wxPython.
}
563 \membersection{wxDateTime::GetTimeNow
}\label{wxdatetimegettimenow
}
565 \func{static time
\_t}{GetTimeNow
}{\void}
567 Returns the current time.
570 \membersection{wxDateTime::GetTmNow
}\label{wxdatetimegettmnow
}
572 \func{static struct tm *
}{GetTmNow
}{\param{struct tm *
}{tm
}}
574 Returns the current time broken down, uses the buffer whose adress is
575 passed to the function via
{\it tm
} to store the result.
577 \membersection{wxDateTime::GetTmNow
}
579 \func{static struct tm *
}{GetTmNow
}{\void}
581 Returns the current time broken down. Note that this function returns a
582 pointer to a static buffer that's reused by calls to this function and
583 certain C library functions (e.g. localtime). If there is any chance your
584 code might be used in a multi-threaded application, you really should use
585 the flavour of function
\helpref{wxDateTime::GetTmNow
}{wxdatetimegettmnow
}
588 \membersection{wxDateTime::GetWeekDayName
}\label{wxdatetimegetweekdayname
}
590 \func{static wxString
}{GetWeekDayName
}{\param{WeekDay
}{weekday
},
\param{NameFlags
}{flags = Name
\_Full}}
592 Gets the full (default) or abbreviated (specify
{\tt Name
\_Abbr} name of the
597 \helpref{GetMonthName
}{wxdatetimegetmonthname
}
600 \membersection{wxDateTime::IsLeapYear
}\label{wxdatetimeisleapyear
}
602 \func{static bool
}{IsLeapYear
}{\param{int
}{year = Inv
\_Year},
\param{Calendar
}{cal = Gregorian
}}
604 Returns
{\tt true
} if the
{\it year
} is a leap one in the specified calendar.
606 This functions supports Gregorian and Julian calendars.
609 \membersection{wxDateTime::IsWestEuropeanCountry
}\label{wxdatetimeiswesteuropeancountry
}
611 \func{static bool
}{IsWestEuropeanCountry
}{\param{Country
}{country = Country
\_Default}}
613 This function returns
{\tt true
} if the specified (or default) country is one
614 of Western European ones. It is used internally by wxDateTime to determine the
615 DST convention and date and time formatting rules.
618 \membersection{wxDateTime::IsDSTApplicable
}\label{wxdatetimeisdstapplicable
}
620 \func{static bool
}{IsDSTApplicable
}{\param{int
}{year = Inv
\_Year},
\param{Country
}{country = Country
\_Default}}
622 Returns
{\tt true
} if DST was used n the given year (the current one by
623 default) in the given country.
626 \membersection{wxDateTime::Now
}\label{wxdatetimenow
}
628 \func{static wxDateTime
}{Now
}{\void}
630 Returns the object corresponding to the current time.
635 wxDateTime now = wxDateTime::Now();
636 printf("Current time in Paris:
\t%s\n", now.Format("%c", wxDateTime::CET).c_str());
639 Note that this function is accurate up to second:
640 \helpref{wxDateTime::UNow
}{wxdatetimeunow
} should be used for better precision
641 (but it is less efficient and might not be available on all platforms).
645 \helpref{Today
}{wxdatetimetoday
}
648 \membersection{wxDateTime::SetCountry
}\label{wxdatetimesetcountry
}
650 \func{static void
}{SetCountry
}{\param{Country
}{country
}}
652 Sets the country to use by default. This setting influences the DST
653 calculations, date formatting and other things.
655 The possible values for
{\it country
} parameter are enumerated in
656 \helpref{wxDateTime constants section
}{wxdatetime
}.
660 \helpref{GetCountry
}{wxdatetimegetcountry
}
663 \membersection{wxDateTime::Today
}\label{wxdatetimetoday
}
665 \func{static wxDateTime
}{Today
}{\void}
667 Returns the object corresponding to the midnight of the current day (i.e. the
668 same as
\helpref{Now()
}{wxdatetimenow
}, but the time part is set to $
0$).
672 \helpref{Now
}{wxdatetimenow
}
675 \membersection{wxDateTime::UNow
}\label{wxdatetimeunow
}
677 \func{static wxDateTime
}{UNow
}{\void}
679 Returns the object corresponding to the current time including the
680 milliseconds if a function to get time with such precision is available on the
681 current platform (supported under most Unices and Win32).
685 \helpref{Now
}{wxdatetimenow
}
687 %%%%%%%%%%%%%%%%%%%%%%%%%%% constructors &c %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
690 \membersection{wxDateTime::wxDateTime
}\label{wxdatetimewxdatetimedef
}
692 \func{}{wxDateTime
}{\void}
694 Default constructor. Use one of
{\tt Set()
} functions to initialize the object
698 \membersection{wxDateTime::wxDateTime
}\label{wxdatetimewxdatetimetimet
}
700 \func{wxDateTime\&
}{wxDateTime
}{\param{time
\_t }{timet
}}
702 Same as
\helpref{Set
}{wxdatetimewxdatetimetimet
}.
704 \pythonnote{This constructor is named
{\tt wxDateTimeFromTimeT
} in wxPython.
}
707 \membersection{wxDateTime::wxDateTime
}\label{wxdatetimewxdatetimetm
}
709 \func{wxDateTime\&
}{wxDateTime
}{\param{const struct tm\&
}{tm
}}
711 Same as
\helpref{Set
}{wxdatetimewxdatetimetm
}
713 \pythonnote{Unsupported.
}
716 \membersection{wxDateTime::wxDateTime
}\label{wxdatetimewxdatetimejdn
}
718 \func{wxDateTime\&
}{wxDateTime
}{\param{double
}{jdn
}}
720 Same as
\helpref{Set
}{wxdatetimewxdatetimejdn
}
722 \pythonnote{This constructor is named
{\tt wxDateTimeFromJDN
} in wxPython.
}
725 \membersection{wxDateTime::wxDateTime
}\label{wxdatetimewxdatetimetime
}
727 \func{wxDateTime\&
}{wxDateTime
}{\param{wxDateTime
\_t }{hour
},
\param{wxDateTime
\_t }{minute =
0},
\param{wxDateTime
\_t }{second =
0},
\param{wxDateTime
\_t }{millisec =
0}}
729 Same as
\helpref{Set
}{wxdatetimewxdatetimetime
}
731 \pythonnote{This constructor is named
{\tt wxDateTimeFromHMS
} in wxPython.
}
734 \membersection{wxDateTime::wxDateTime
}\label{wxdatetimewxdatetimedate
}
736 \func{wxDateTime\&
}{wxDateTime
}{\param{wxDateTime
\_t }{day
},
\param{Month
}{month = Inv
\_Month},
\param{int
}{ Inv
\_Year},
737 \param{wxDateTime
\_t }{hour =
0},
\param{wxDateTime
\_t }{minute =
0},
\param{wxDateTime
\_t }{second =
0},
\param{wxDateTime
\_t }{millisec =
0}}
739 Same as
\helpref{Set
}{wxdatetimesetdate
}
741 \pythonnote{This constructor is named
{\tt wxDateTimeFromDMY
} in wxPython.
}
744 \membersection{wxDateTime::SetToCurrent
}\label{wxdatetimesettocurrent
}
746 \func{wxDateTime\&
}{SetToCurrent
}{\void}
748 Sets the date and time of to the current values. Same as assigning the result
749 of
\helpref{Now()
}{wxdatetimenow
} to this object.
752 \membersection{wxDateTime::Set
}\label{wxdatetimesettimet
}
754 \func{wxDateTime\&
}{Set
}{\param{time
\_t }{timet
}}
756 Constructs the object from
{\it timet
} value holding the number of seconds
759 \pythonnote{This method is named
{\tt SetTimeT
} in wxPython.
}
762 \membersection{wxDateTime::Set
}\label{wxdatetimesettm
}
764 \func{wxDateTime\&
}{Set
}{\param{const struct tm\&
}{tm
}}
766 Sets the date and time from the broken down representation in the standard
769 \pythonnote{Unsupported.
}
772 \membersection{wxDateTime::Set
}\label{wxdatetimesetjdn
}
774 \func{wxDateTime\&
}{Set
}{\param{double
}{jdn
}}
776 Sets the date from the so-called
{\it Julian Day Number
}.
778 By definition, the Julian Day Number, usually abbreviated as JDN, of a
779 particular instant is the fractional number of days since
12 hours Universal
780 Coordinated Time (Greenwich mean noon) on January
1 of the year -
4712 in the
781 Julian proleptic calendar.
783 \pythonnote{This method is named
{\tt SetJDN
} in wxPython.
}
786 \membersection{wxDateTime::Set
}\label{wxdatetimesettime
}
788 \func{wxDateTime\&
}{Set
}{\param{wxDateTime
\_t }{hour
},
\param{wxDateTime
\_t }{minute =
0},
\param{wxDateTime
\_t }{second =
0},
\param{wxDateTime
\_t }{millisec =
0}}
790 Sets the date to be equal to
\helpref{Today
}{wxdatetimetoday
} and the time
791 from supplied parameters.
793 \pythonnote{This method is named
{\tt SetHMS
} in wxPython.
}
796 \membersection{wxDateTime::Set
}\label{wxdatetimesetdate
}
798 \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}}
800 Sets the date and time from the parameters.
803 \membersection{wxDateTime::ResetTime
}\label{wxdatetimeresettime
}
805 \func{wxDateTime\&
}{ResetTime
}{\void}
807 Reset time to midnight (
00:
00:
00) without changing the date.
810 \membersection{wxDateTime::SetYear
}\label{wxdatetimesetyear
}
812 \func{wxDateTime\&
}{SetYear
}{\param{int
}{year
}}
814 Sets the year without changing other date components.
817 \membersection{wxDateTime::SetMonth
}\label{wxdatetimesetmonth
}
819 \func{wxDateTime\&
}{SetMonth
}{\param{Month
}{month
}}
821 Sets the month without changing other date components.
824 \membersection{wxDateTime::SetDay
}\label{wxdatetimesetday
}
826 \func{wxDateTime\&
}{SetDay
}{\param{wxDateTime
\_t }{day
}}
828 Sets the day without changing other date components.
831 \membersection{wxDateTime::SetHour
}\label{wxdatetimesethour
}
833 \func{wxDateTime\&
}{SetHour
}{\param{wxDateTime
\_t }{hour
}}
835 Sets the hour without changing other date components.
838 \membersection{wxDateTime::SetMinute
}\label{wxdatetimesetminute
}
840 \func{wxDateTime\&
}{SetMinute
}{\param{wxDateTime
\_t }{minute
}}
842 Sets the minute without changing other date components.
845 \membersection{wxDateTime::SetSecond
}\label{wxdatetimesetsecond
}
847 \func{wxDateTime\&
}{SetSecond
}{\param{wxDateTime
\_t }{second
}}
849 Sets the second without changing other date components.
852 \membersection{wxDateTime::SetMillisecond
}\label{wxdatetimesetmillisecond
}
854 \func{wxDateTime\&
}{SetMillisecond
}{\param{wxDateTime
\_t }{millisecond
}}
856 Sets the millisecond without changing other date components.
859 \membersection{wxDateTime::operator$=$
}\label{wxdatetimeoperatoreqtimet
}
861 \func{wxDateTime\&
}{operator
}{\param{time
\_t }{timet
}}
863 Same as
\helpref{Set
}{wxdatetimesettimet
}.
866 \membersection{wxDateTime::operator$=$
}\label{wxdatetimeoperatoreqtm
}
868 \func{wxDateTime\&
}{operator
}{\param{const struct tm\&
}{tm
}}
870 Same as
\helpref{Set
}{wxdatetimesettm
}.
872 %%%%%%%%%%%%%%%%%%%%%%%%%%% accessors %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
875 \membersection{wxDateTime::IsValid
}\label{wxdatetimeisvalid
}
877 \constfunc{bool
}{IsValid
}{\void}
879 Returns
{\tt true
} if the object represents a valid time moment.
882 \membersection{wxDateTime::GetDateOnly
}\label{wxdatetimegetdateonly
}
884 \constfunc{wxDateTime
}{GetDateOnly
}{\void}
886 Returns the object having the same date component as this one but time of
893 \helpref{ResetTime
}{wxdatetimeresettime
}
896 \membersection{wxDateTime::GetTm
}\label{wxdatetimegettm
}
898 \constfunc{Tm
}{GetTm
}{\param{const TimeZone\&
}{tz = Local
}}
900 Returns broken down representation of the date and time.
903 \membersection{wxDateTime::GetTicks
}\label{wxdatetimegetticks
}
905 \constfunc{time
\_t}{GetTicks
}{\void}
907 Returns the number of seconds since Jan
1,
1970. An assert failure will occur
908 if the date is not in the range covered by
{\tt time
\_t} type.
911 \membersection{wxDateTime::GetCentury
}\label{wxdatetimegetcentury
}
913 \constfunc{int
}{GetCentury
}{\param{const TimeZone\&
}{tz = Local
}}
915 Returns the century of this date.
918 \membersection{wxDateTime::GetYear
}\label{wxdatetimegetyear
}
920 \constfunc{int
}{GetYear
}{\param{const TimeZone\&
}{tz = Local
}}
922 Returns the year in the given timezone (local one by default).
925 \membersection{wxDateTime::GetMonth
}\label{wxdatetimegetmonth
}
927 \constfunc{Month
}{GetMonth
}{\param{const TimeZone\&
}{tz = Local
}}
929 Returns the month in the given timezone (local one by default).
932 \membersection{wxDateTime::GetDay
}\label{wxdatetimegetday
}
934 \constfunc{wxDateTime
\_t}{GetDay
}{\param{const TimeZone\&
}{tz = Local
}}
936 Returns the day in the given timezone (local one by default).
939 \membersection{wxDateTime::GetWeekDay
}\label{wxdatetimegetweekday
}
941 \constfunc{WeekDay
}{GetWeekDay
}{\param{const TimeZone\&
}{tz = Local
}}
943 Returns the week day in the given timezone (local one by default).
946 \membersection{wxDateTime::GetHour
}\label{wxdatetimegethour
}
948 \constfunc{wxDateTime
\_t}{GetHour
}{\param{const TimeZone\&
}{tz = Local
}}
950 Returns the hour in the given timezone (local one by default).
953 \membersection{wxDateTime::GetMinute
}\label{wxdatetimegetminute
}
955 \constfunc{wxDateTime
\_t}{GetMinute
}{\param{const TimeZone\&
}{tz = Local
}}
957 Returns the minute in the given timezone (local one by default).
960 \membersection{wxDateTime::GetSecond
}\label{wxdatetimegetsecond
}
962 \constfunc{wxDateTime
\_t}{GetSecond
}{\param{const TimeZone\&
}{tz = Local
}}
964 Returns the seconds in the given timezone (local one by default).
967 \membersection{wxDateTime::GetMillisecond
}\label{wxdatetimegetmillisecond
}
969 \constfunc{wxDateTime
\_t}{GetMillisecond
}{\param{const TimeZone\&
}{tz = Local
}}
971 Returns the milliseconds in the given timezone (local one by default).
974 \membersection{wxDateTime::GetDayOfYear
}\label{wxdatetimegetdayofyear
}
976 \constfunc{wxDateTime
\_t}{GetDayOfYear
}{\param{const TimeZone\&
}{tz = Local
}}
978 Returns the day of the year (in $
1\ldots366$ range) in the given timezone
979 (local one by default).
982 \membersection{wxDateTime::GetWeekOfYear
}\label{wxdatetimegetweekofyear
}
984 \constfunc{wxDateTime
\_t}{GetWeekOfYear
}{\param{WeekFlags
}{flags = Monday
\_First},
\param{const TimeZone\&
}{tz = Local
}}
986 Returns the number of the week of the year this date is in. The first week of
987 the year is, according to international standards, the one containing Jan
4 or,
988 equivalently, the first week which has Thursday in this year. Both of these
989 definitions are the same as saying that the first week of the year must contain
990 more than half of its days in this year. Accordingly, the week number will
991 always be in $
1\ldots53$ range ($
52$ for non-leap years).
993 The function depends on the
\helpref{week start
}{wxdatetime
} convention
994 specified by the
{\it flags
} argument but its results for
995 \texttt{Sunday
\_First} are not well-defined as the ISO definition quoted above
996 applies to the weeks starting on Monday only.
999 \membersection{wxDateTime::GetWeekOfMonth
}\label{wxdatetimegetweekofmonth
}
1001 \constfunc{wxDateTime
\_t}{GetWeekOfMonth
}{\param{WeekFlags
}{flags = Monday
\_First},
\param{const TimeZone\&
}{tz = Local
}}
1003 Returns the ordinal number of the week in the month (in $
1\ldots5$ range).
1005 As
\helpref{GetWeekOfYear
}{wxdatetimegetweekofyear
}, this function supports
1006 both conventions for the week start. See the description of these
1007 \helpref{week start
}{wxdatetime
} conventions.
1010 \membersection{wxDateTime::IsWorkDay
}\label{wxdatetimeisworkday
}
1012 \constfunc{bool
}{IsWorkDay
}{\param{Country
}{country = Country
\_Default}}
1014 Returns
{\tt true
} is this day is not a holiday in the given country.
1017 \membersection{wxDateTime::IsGregorianDate
}\label{wxdatetimeisgregoriandate
}
1019 \constfunc{bool
}{IsGregorianDate
}{\param{GregorianAdoption
}{country = Gr
\_Standard}}
1021 Returns
{\tt true
} if the given date is later than the date of adoption of the
1022 Gregorian calendar in the given country (and hence the Gregorian calendar
1023 calculations make sense for it).
1025 %%%%%%%%%%%%%%%%%%%%%% dos date and time format %%%%%%%%%%%%%%%%%%%%%%%
1028 \membersection{wxDateTime::SetFromDOS
}\label{wxdatetimesetfromdos
}
1030 \func{wxDateTime\&
}{Set
}{\param{unsigned long
}{ddt
}}
1032 Sets the date from the date and time in
1033 \urlref{DOS
}{http://developer.novell.com/ndk/doc/smscomp/index.html?page=/ndk/doc/smscomp/sms
\_docs/data/hc2vlu5i.html
}
1037 \membersection{wxDateTime::GetAsDOS
}\label{wxdatetimegetasdos
}
1039 \constfunc{unsigned long
}{GetAsDOS
}{\void}
1041 Returns the date and time in
1042 \urlref{DOS
}{http://developer.novell.com/ndk/doc/smscomp/index.html?page=/ndk/doc/smscomp/sms
\_docs/data/hc2vlu5i.html
}
1045 %%%%%%%%%%%%%%%%%%%%%%%%%%% comparison %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1048 \membersection{wxDateTime::IsEqualTo
}\label{wxdatetimeisequalto
}
1050 \constfunc{bool
}{IsEqualTo
}{\param{const wxDateTime\&
}{datetime
}}
1052 Returns
{\tt true
} if the two dates are strictly identical.
1055 \membersection{wxDateTime::IsEarlierThan
}\label{wxdatetimeisearlierthan
}
1057 \constfunc{bool
}{IsEarlierThan
}{\param{const wxDateTime\&
}{datetime
}}
1059 Returns
{\tt true
} if this date precedes the given one.
1062 \membersection{wxDateTime::IsLaterThan
}\label{wxdatetimeislaterthan
}
1064 \constfunc{bool
}{IsLaterThan
}{\param{const wxDateTime\&
}{datetime
}}
1066 Returns
{\tt true
} if this date is later than the given one.
1069 \membersection{wxDateTime::IsStrictlyBetween
}\label{wxdatetimeisstrictlybetween
}
1071 \constfunc{bool
}{IsStrictlyBetween
}{\param{const wxDateTime\&
}{t1
},
\param{const wxDateTime\&
}{t2
}}
1073 Returns
{\tt true
} if this date lies strictly between the two others,
1075 \wxheading{See also
}
1077 \helpref{IsBetween
}{wxdatetimeisbetween
}
1080 \membersection{wxDateTime::IsBetween
}\label{wxdatetimeisbetween
}
1082 \constfunc{bool
}{IsBetween
}{\param{const wxDateTime\&
}{t1
},
\param{const wxDateTime\&
}{t2
}}
1084 Returns
{\tt true
} if
\helpref{IsStrictlyBetween
}{wxdatetimeisstrictlybetween
}
1085 is
{\tt true
} or if the date is equal to one of the limit values.
1087 \wxheading{See also
}
1089 \helpref{IsStrictlyBetween
}{wxdatetimeisstrictlybetween
}
1092 \membersection{wxDateTime::IsSameDate
}\label{wxdatetimeissamedate
}
1094 \constfunc{bool
}{IsSameDate
}{\param{const wxDateTime\&
}{dt
}}
1096 Returns
{\tt true
} if the date is the same without comparing the time parts.
1099 \membersection{wxDateTime::IsSameTime
}\label{wxdatetimeissametime
}
1101 \constfunc{bool
}{IsSameTime
}{\param{const wxDateTime\&
}{dt
}}
1103 Returns
{\tt true
} if the time is the same (although dates may differ).
1106 \membersection{wxDateTime::IsEqualUpTo
}\label{wxdatetimeisequalupto
}
1108 \constfunc{bool
}{IsEqualUpTo
}{\param{const wxDateTime\&
}{dt
},
\param{const wxTimeSpan\&
}{ts
}}
1110 Returns
{\tt true
} if the date is equal to another one up to the given time
1111 interval, i.e. if the absolute difference between the two dates is less than
1114 %%%%%%%%%%%%%%%%%%%%%%%%%%% arithmetics %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1117 \membersection{wxDateTime::Add
}\label{wxdatetimeaddts
}
1119 \constfunc{wxDateTime
}{Add
}{\param{const wxTimeSpan\&
}{diff
}}
1121 \func{wxDateTime\&
}{Add
}{\param{const wxTimeSpan\&
}{diff
}}
1123 \func{wxDateTime\&
}{operator$+=$
}{\param{const wxTimeSpan\&
}{diff
}}
1125 Adds the given time span to this object.
1127 \pythonnote{This method is named
{\tt AddTS
} in wxPython.
}
1131 \membersection{wxDateTime::Add
}\label{wxdatetimeaddds
}
1133 \constfunc{wxDateTime
}{Add
}{\param{const wxDateSpan\&
}{diff
}}
1135 \func{wxDateTime\&
}{Add
}{\param{const wxDateSpan\&
}{diff
}}
1137 \func{wxDateTime\&
}{operator$+=$
}{\param{const wxDateSpan\&
}{diff
}}
1139 Adds the given date span to this object.
1141 \pythonnote{This method is named
{\tt AddDS
} in wxPython.
}
1145 \membersection{wxDateTime::Subtract
}\label{wxdatetimesubtractts
}
1147 \constfunc{wxDateTime
}{Subtract
}{\param{const wxTimeSpan\&
}{diff
}}
1149 \func{wxDateTime\&
}{Subtract
}{\param{const wxTimeSpan\&
}{diff
}}
1151 \func{wxDateTime\&
}{operator$-=$
}{\param{const wxTimeSpan\&
}{diff
}}
1153 Subtracts the given time span from this object.
1155 \pythonnote{This method is named
{\tt SubtractTS
} in wxPython.
}
1159 \membersection{wxDateTime::Subtract
}\label{wxdatetimesubtractds
}
1161 \constfunc{wxDateTime
}{Subtract
}{\param{const wxDateSpan\&
}{diff
}}
1163 \func{wxDateTime\&
}{Subtract
}{\param{const wxDateSpan\&
}{diff
}}
1165 \func{wxDateTime\&
}{operator$-=$
}{\param{const wxDateSpan\&
}{diff
}}
1167 Subtracts the given date span from this object.
1169 \pythonnote{This method is named
{\tt SubtractDS
} in wxPython.
}
1173 \membersection{wxDateTime::Subtract
}\label{wxdatetimesubtractdt
}
1175 \constfunc{wxTimeSpan
}{Subtract
}{\param{const wxDateTime\&
}{dt
}}
1177 Subtracts another date from this one and returns the difference between them
1180 %%%%%%%%%%%%%%%%%%%%%%%%%%% parsing/formatting %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1183 \membersection{wxDateTime::ParseRfc822Date
}\label{wxdatetimeparserfc822date
}
1185 \func{const char *
}{ParseRfc822Date
}{\param{const wxString\&
}{date
},
\param{wxString::const
\_iterator *
}{end =
\NULL}}
1187 \func{const char *
}{ParseRfc822Date
}{\param{const char*
}{date
}}
1189 \func{const wchar
\_t *
}{ParseRfc822Date
}{\param{const wchar
\_t*
}{date
}}
1191 Parses the string
\arg{date
} looking for a date formatted according to the RFC
1192 822 in it. The exact description of this format may, of course, be found in
1193 the RFC (section $
5$), but, briefly, this is the format used in the headers of
1194 Internet email messages and one of the most common strings expressing date in
1195 this format may be something like
{\tt "Sat,
18 Dec
1999 00:
48:
30 +
0100"
}.
1197 Returns
{\tt NULL
} if the conversion failed, otherwise return the pointer to
1198 the character immediately following the part of the string which could be
1199 parsed. If the entire string contains only the date in RFC
822 format,
1200 the returned pointer will be pointing to a
{\tt NUL
} character.
1202 This function is intentionally strict, it will return an error for any string
1203 which is not RFC
822 compliant. If you need to parse date formatted in more
1204 free ways, you should use
\helpref{ParseDateTime
}{wxdatetimeparsedatetime
} or
1205 \helpref{ParseDate
}{wxdatetimeparsedate
} instead.
1208 \membersection{wxDateTime::ParseFormat
}\label{wxdatetimeparseformat
}
1210 \func{const char *
}{ParseFormat
}{\param{const wxString\&
}{date
},
\param{const wxString\&
}{format = wxDefaultDateTimeFormat
},
\param{const wxDateTime\&
}{dateDef = wxDefaultDateTime
},
\param{wxString::const
\_iterator *
}{end =
\NULL}}
1212 \func{const char *
}{ParseFormat
}{\param{const char *
}{date
},
\param{const wxString\&
}{format = wxDefaultDateTimeFormat
},
\param{const wxDateTime\&
}{dateDef = wxDefaultDateTime
}}
1214 \func{const wchar
\_t *
}{ParseFormat
}{\param{const wchar
\_t *
}{date
},
\param{const wxString\&
}{format = wxDefaultDateTimeFormat
},
\param{const wxDateTime\&
}{dateDef = wxDefaultDateTime
}}
1216 This function parses the string
{\it date
} according to the given
1217 {\it format
}. The system
{\tt strptime(
3)
} function is used whenever available,
1218 but even if it is not, this function is still implemented, although support
1219 for locale-dependent format specifiers such as
{\tt "\%c"
},
{\tt "\%x"
} or
{\tt "\%X"
} may
1220 not be perfect and GNU extensions such as
{\tt "\%z"
} and
{\tt "\%Z"
} are
1221 not implemented. This function does handle the month and weekday
1222 names in the current locale on all platforms, however.
1224 Please see the description of the ANSI C function
{\tt strftime(
3)
} for the syntax
1225 of the format string.
1227 The
{\it dateDef
} parameter is used to fill in the fields which could not be
1228 determined from the format string. For example, if the format is
{\tt "\%d"
} (the
1229 ay of the month), the month and the year are taken from
{\it dateDef
}. If
1230 it is not specified,
\helpref{Today
}{wxdatetimetoday
} is used as the
1233 Returns
{\tt NULL
} if the conversion failed, otherwise return the pointer to
1234 the character which stopped the scan.
1237 \membersection{wxDateTime::ParseDateTime
}\label{wxdatetimeparsedatetime
}
1239 \func{const char *
}{ParseDateTime
}{\param{const wxString\&
}{datetime
},
\param{wxString::const
\_iterator *
}{end =
\NULL}}
1241 \func{const char *
}{ParseDateTime
}{\param{const char *
}{datetime
}}
1243 \func{const wchar
\_t *
}{ParseDateTime
}{\param{const wchar
\_t *
}{datetime
}}
1245 Parses the string
{\it datetime
} containing the date and time in free format.
1246 This function tries as hard as it can to interpret the given string as date
1247 and time. Unlike
\helpref{ParseRfc822Date
}{wxdatetimeparserfc822date
}, it
1248 will accept anything that may be accepted and will only reject strings which
1249 can not be parsed in any way at all.
1251 Returns
{\tt NULL
} if the conversion failed, otherwise return the pointer to
1252 the character which stopped the scan.
1255 \membersection{wxDateTime::ParseDate
}\label{wxdatetimeparsedate
}
1257 \func{const char *
}{ParseDate
}{\param{const wxString\&
}{date
},
\param{wxString::const
\_iterator *
}{end =
\NULL}}
1259 \func{const char *
}{ParseDate
}{\param{const char *
}{date
}}
1261 \func{const wchar
\_t *
}{ParseDate
}{\param{const wchar
\_t *
}{date
}}
1263 This function is like
\helpref{ParseDateTime
}{wxdatetimeparsedatetime
}, but it
1264 only allows the date to be specified. It is thus less flexible then
1265 \helpref{ParseDateTime
}{wxdatetimeparsedatetime
}, but also has less chances to
1266 misinterpret the user input.
1268 Returns
{\tt NULL
} if the conversion failed, otherwise return the pointer to
1269 the character which stopped the scan.
1272 \membersection{wxDateTime::ParseTime
}\label{wxdatetimeparsetime
}
1274 \func{const char *
}{ParseTime
}{\param{const wxString\&
}{time
},
\param{wxString::const
\_iterator *
}{end =
\NULL}}
1276 \func{const char *
}{ParseTime
}{\param{const char *
}{time
}}
1278 \func{const wchar
\_t *
}{ParseTime
}{\param{const wchar
\_t *
}{time
}}
1280 This functions is like
\helpref{ParseDateTime
}{wxdatetimeparsedatetime
}, but
1281 only allows the time to be specified in the input string.
1283 Returns
{\tt NULL
} if the conversion failed, otherwise return the pointer to
1284 the character which stopped the scan.
1287 \membersection{wxDateTime::ParseISODate
}\label{wxdatetimeparseisodate
}
1289 \func{bool
}{ParseISODate
}{\param{const wxString\&
}{date
}}
1291 This function parses the date in ISO
8601 format (YYYY-MM-DD).
1293 Returns
\true if the entire string was parsed successfully,
\false otherwise.
1296 \membersection{wxDateTime::ParseISOTime
}\label{wxdatetimeparseisotime
}
1298 \func{bool
}{ParseISOTime
}{\param{const wxString\&
}{date
}}
1300 This function parses the time in ISO
8601 format (HH:MM:SS).
1302 Returns
\true if the entire string was parsed successfully,
\false otherwise.
1305 \membersection{wxDateTime::ParseISOCombined
}\label{wxdatetimeparseisocombined
}
1307 \func{bool
}{ParseISOCombined
}{\param{const wxString\&
}{date
},
\param{char
}{sep = 'T'
}}
1309 This function parses the string containing the date and time in ISO
8601
1310 combined format (YYYY-MM-DDTHH:MM:SS). The separator between the date and time
1311 parts must be equal to
\arg{sep
} for the function to succeed.
1313 Returns
\true if the entire string was parsed successfully,
\false otherwise.
1316 \membersection{wxDateTime::Format
}\label{wxdatetimeformat
}
1318 \constfunc{wxString
}{Format
}{\param{const wxChar *
}{format = wxDefaultDateTimeFormat
},
\param{const TimeZone\&
}{tz = Local
}}
1320 This function does the same as the standard ANSI C
{\tt strftime(
3)
} function.
1321 Please see its description for the meaning of
{\it format
} parameter.
1323 It also accepts a few wxWidgets-specific extensions: you can optionally specify
1324 the width of the field to follow using
{\tt printf(
3)
}-like syntax and the
1325 format specification
{\tt \%l
} can be used to get the number of milliseconds.
1327 \wxheading{See also
}
1329 \helpref{ParseFormat
}{wxdatetimeparseformat
}
1332 \membersection{wxDateTime::FormatDate
}\label{wxdatetimeformatdate
}
1334 \constfunc{wxString
}{FormatDate
}{\void}
1336 Identical to calling
\helpref{Format()
}{wxdatetimeformat
} with
{\tt "\%x"
}
1337 argument (which means `preferred date representation for the current locale').
1340 \membersection{wxDateTime::FormatTime
}\label{wxdatetimeformattime
}
1342 \constfunc{wxString
}{FormatTime
}{\void}
1344 Identical to calling
\helpref{Format()
}{wxdatetimeformat
} with
{\tt "\%X"
}
1345 argument (which means `preferred time representation for the current locale').
1348 \membersection{wxDateTime::FormatISOCombined
}\label{wxdatetimeformatisocombined
}
1350 \constfunc{wxString
}{FormatISOCombined
}{\param{char
}{sep = 'T'
}}
1352 Returns the combined date-time representation in the ISO
8601 format
1353 (YYYY-MM-DDTHH:MM:SS). The
\arg{sep
} parameter default value produces the
1354 result exactly corresponding to the ISO standard, but it can also be useful to
1355 use a space as seprator if a more human-readable combined date-time
1356 representation is needed.
1358 \wxheading{See also
}
1360 \helpref{FormatISODate
}{wxdatetimeformatisodate
},\\
1361 \helpref{FormatISOTime
}{wxdatetimeformatisotime
},\\
1362 \helpref{ParseISOCombined
}{wxdatetimeparseisocombined
}
1365 \membersection{wxDateTime::FormatISODate
}\label{wxdatetimeformatisodate
}
1367 \constfunc{wxString
}{FormatISODate
}{\void}
1369 This function returns the date representation in the ISO
8601 format
1373 \membersection{wxDateTime::FormatISOTime
}\label{wxdatetimeformatisotime
}
1375 \constfunc{wxString
}{FormatISOTime
}{\void}
1377 This function returns the time representation in the ISO
8601 format
1380 %%%%%%%%%%%%%%%%%%%%%%%%%%% calendar calculations %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1383 \membersection{wxDateTime::SetToWeekDayInSameWeek
}\label{wxdatetimesettoweekdayinsameweek
}
1385 \func{wxDateTime\&
}{SetToWeekDayInSameWeek
}{\param{WeekDay
}{weekday
},
\param{WeekFlags
}{flags =
{\tt Monday
\_First}}}
1387 Adjusts the date so that it will still lie in the same week as before, but its
1388 week day will be the given one.
1390 Returns the reference to the modified object itself.
1393 \membersection{wxDateTime::GetWeekDayInSameWeek
}\label{wxdatetimegetweekdayinsameweek
}
1395 \constfunc{wxDateTime
}{GetWeekDayInSameWeek
}{\param{WeekDay
}{weekday
},
\param{WeekFlags
}{flags =
{\tt Monday
\_First}}}
1397 Returns the copy of this object to which
1398 \helpref{SetToWeekDayInSameWeek
}{wxdatetimesettoweekdayinsameweek
} was
1402 \membersection{wxDateTime::SetToNextWeekDay
}\label{wxdatetimesettonextweekday
}
1404 \func{wxDateTime\&
}{SetToNextWeekDay
}{\param{WeekDay
}{weekday
}}
1406 Sets the date so that it will be the first
{\it weekday
} following the current
1409 Returns the reference to the modified object itself.
1412 \membersection{wxDateTime::GetNextWeekDay
}\label{wxdatetimegetnextweekday
}
1414 \constfunc{wxDateTime
}{GetNextWeekDay
}{\param{WeekDay
}{weekday
}}
1416 Returns the copy of this object to which
1417 \helpref{SetToNextWeekDay
}{wxdatetimesettonextweekday
} was applied.
1420 \membersection{wxDateTime::SetToPrevWeekDay
}\label{wxdatetimesettoprevweekday
}
1422 \func{wxDateTime\&
}{SetToPrevWeekDay
}{\param{WeekDay
}{weekday
}}
1424 Sets the date so that it will be the last
{\it weekday
} before the current
1427 Returns the reference to the modified object itself.
1430 \membersection{wxDateTime::GetPrevWeekDay
}\label{wxdatetimegetprevweekday
}
1432 \constfunc{wxDateTime
}{GetPrevWeekDay
}{\param{WeekDay
}{weekday
}}
1434 Returns the copy of this object to which
1435 \helpref{SetToPrevWeekDay
}{wxdatetimesettoprevweekday
} was applied.
1438 \membersection{wxDateTime::SetToWeekDay
}\label{wxdatetimesettoweekday
}
1440 \func{bool
}{SetToWeekDay
}{\param{WeekDay
}{weekday
},
\param{int
}{n =
1},
\param{Month
}{month = Inv
\_Month},
\param{int
}{year = Inv
\_Year}}
1442 Sets the date to the
{\it n
}-th
{\it weekday
} in the given month of the given
1443 year (the current month and year are used by default). The parameter
{\it n
}
1444 may be either positive (counting from the beginning of the month) or negative
1445 (counting from the end of it).
1447 For example,
{\tt SetToWeekDay(
2, wxDateTime::Wed)
} will set the date to the
1448 second Wednesday in the current month and
1449 {\tt SetToWeekDay(-
1, wxDateTime::Sun)
} -- to the last Sunday in it.
1451 Returns
{\tt true
} if the date was modified successfully,
{\tt false
}
1452 otherwise meaning that the specified date doesn't exist.
1455 \membersection{wxDateTime::GetWeekDay
}\label{wxdatetimegetweekday2
}
1457 \constfunc{wxDateTime
}{GetWeekDay
}{\param{WeekDay
}{weekday
},
\param{int
}{n =
1},
\param{Month
}{month = Inv
\_Month},
\param{int
}{year = Inv
\_Year}}
1459 Returns the copy of this object to which
1460 \helpref{SetToWeekDay
}{wxdatetimesettoweekday
} was applied.
1463 \membersection{wxDateTime::SetToLastWeekDay
}\label{wxdatetimesettolastweekday
}
1465 \func{bool
}{SetToLastWeekDay
}{\param{WeekDay
}{weekday
},
\param{Month
}{month = Inv
\_Month},
\param{int
}{year = Inv
\_Year}}
1467 The effect of calling this function is the same as of calling
1468 {\tt SetToWeekDay(-
1, weekday, month, year)
}. The date will be set to the last
1469 {\it weekday
} in the given month and year (the current ones by default).
1471 Always returns
{\tt true
}.
1474 \membersection{wxDateTime::GetLastWeekDay
}\label{wxdatetimegetlastweekday
}
1476 \func{wxDateTime
}{GetLastWeekDay
}{\param{WeekDay
}{weekday
},
\param{Month
}{month = Inv
\_Month},
\param{int
}{year = Inv
\_Year}}
1478 Returns the copy of this object to which
1479 \helpref{SetToLastWeekDay
}{wxdatetimesettolastweekday
} was applied.
1482 \membersection{wxDateTime::SetToWeekOfYear
}\label{wxdatetimesettoweekofyear
}
1484 \func{static wxDateTime
}{SetToWeekOfYear
}{\param{int
}{year
},
\param{wxDateTime
\_t }{numWeek
},
\param{WeekDay
}{weekday = Mon
}}
1486 Set the date to the given
\arg{weekday
} in the week number
\arg{numWeek
} of the
1487 given
\arg{year
} . The number should be in range $
1\ldots53$.
1489 Note that the returned date may be in a different year than the one passed to
1490 this function because both the week $
1$ and week $
52$ or $
53$ (for leap years)
1491 contain days from different years. See
1492 \helpref{GetWeekOfYear
}{wxdatetimegetweekofyear
} for the explanation of how the
1493 year weeks are counted.
1496 \membersection{wxDateTime::SetToLastMonthDay
}\label{wxdatetimesettolastmonthday
}
1498 \func{wxDateTime\&
}{SetToLastMonthDay
}{\param{Month
}{month = Inv
\_Month},
\param{int
}{year = Inv
\_Year}}
1500 Sets the date to the last day in the specified month (the current one by
1503 Returns the reference to the modified object itself.
1506 \membersection{wxDateTime::GetLastMonthDay
}\label{wxdatetimegetlastmonthday
}
1508 \constfunc{wxDateTime
}{GetLastMonthDay
}{\param{Month
}{month = Inv
\_Month},
\param{int
}{year = Inv
\_Year}}
1510 Returns the copy of this object to which
1511 \helpref{SetToLastMonthDay
}{wxdatetimesettolastmonthday
} was applied.
1514 \membersection{wxDateTime::SetToYearDay
}\label{wxdatetimesettoyearday
}
1516 \func{wxDateTime\&
}{SetToYearDay
}{\param{wxDateTime
\_t }{yday
}}
1518 Sets the date to the day number
{\it yday
} in the same year (i.e., unlike the
1519 other functions, this one does not use the current year). The day number
1520 should be in the range $
1\ldots366$ for the leap years and $
1\ldots365$ for
1523 Returns the reference to the modified object itself.
1526 \membersection{wxDateTime::GetYearDay
}\label{wxdatetimegetyearday
}
1528 \constfunc{wxDateTime
}{GetYearDay
}{\param{wxDateTime
\_t }{yday
}}
1530 Returns the copy of this object to which
1531 \helpref{SetToYearDay
}{wxdatetimesettoyearday
} was applied.
1533 %%%%%%%%%%%%%%%%%%%%%%%%%%% astronomical functions %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1536 \membersection{wxDateTime::GetJulianDayNumber
}\label{wxdatetimegetjuliandaynumber
}
1538 \constfunc{double
}{GetJulianDayNumber
}{\void}
1540 Returns the
\helpref{JDN
}{wxdatetimesetjdn
} corresponding to this date. Beware
1543 \wxheading{See also
}
1545 \helpref{GetModifiedJulianDayNumber
}{wxdatetimegetmodifiedjuliandaynumber
}
1548 \membersection{wxDateTime::GetJDN
}\label{wxdatetimegetjdn
}
1550 \constfunc{double
}{GetJDN
}{\void}
1552 Synonym for
\helpref{GetJulianDayNumber
}{wxdatetimegetjuliandaynumber
}.
1555 \membersection{wxDateTime::GetModifiedJulianDayNumber
}\label{wxdatetimegetmodifiedjuliandaynumber
}
1557 \constfunc{double
}{GetModifiedJulianDayNumber
}{\void}
1559 Returns the
{\it Modified Julian Day Number
} (MJD) which is, by definition,
1560 equal to $JDN -
2400000.5$. The MJDs are simpler to work with as the integral
1561 MJDs correspond to midnights of the dates in the Gregorian calendar and not th
1562 noons like JDN. The MJD $
0$ is Nov
17,
1858.
1565 \membersection{wxDateTime::GetMJD
}\label{wxdatetimegetmjd
}
1567 \constfunc{double
}{GetMJD
}{\void}
1569 Synonym for
\helpref{GetModifiedJulianDayNumber
}{wxdatetimegetmodifiedjuliandaynumber
}.
1572 \membersection{wxDateTime::GetRataDie
}\label{wxdatetimegetratadie
}
1574 \constfunc{double
}{GetRataDie
}{\void}
1576 Return the
{\it Rata Die number
} of this date.
1578 By definition, the Rata Die number is a date specified as the number of days
1579 relative to a base date of December
31 of the year
0. Thus January
1 of the
1580 year
1 is Rata Die day
1.
1582 %%%%%%%%%%%%%%%%%%%%%%%%%%% timezone and DST %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1585 \membersection{wxDateTime::FromTimezone
}\label{wxdatetimefromtimezone
}
1587 \constfunc{wxDateTime
}{FromTimezone
}{\param{const TimeZone\&
}{tz
},
\param{bool
}{noDST = false
}}
1589 Transform the date from the given time zone to the local one. If
{\it noDST
} is
1590 {\tt true
}, no DST adjustments will be made.
1592 Returns the date in the local time zone.
1595 \membersection{wxDateTime::ToTimezone
}\label{wxdatetimetotimezone
}
1597 \constfunc{wxDateTime
}{ToTimezone
}{\param{const TimeZone\&
}{tz
},
\param{bool
}{noDST = false
}}
1599 Transform the date to the given time zone. If
{\it noDST
} is
{\tt true
}, no
1600 DST adjustments will be made.
1602 Returns the date in the new time zone.
1605 \membersection{wxDateTime::MakeTimezone
}\label{wxdatetimemaketimezone
}
1607 \func{wxDateTime\&
}{MakeTimezone
}{\param{const TimeZone\&
}{tz
},
\param{bool
}{noDST = false
}}
1609 Modifies the object in place to represent the date in another time zone. If
1610 {\it noDST
} is
{\tt true
}, no DST adjustments will be made.
1613 \membersection{wxDateTime::MakeFromTimezone
}\label{wxdatetimemakefromtimezone
}
1615 \func{wxDateTime\&
}{MakeFromTimezone
}{\param{const TimeZone\&
}{tz
},
\param{bool
}{noDST = false
}}
1617 Same as
\helpref{FromTimezone
}{wxdatetimefromtimezone
} but modifies the object
1621 \membersection{wxDateTime::ToUTC
}\label{wxdatetimetoutc
}
1623 \constfunc{wxDateTime
}{ToUTC
}{\param{bool
}{noDST = false
}}
1625 This is the same as calling
\helpref{ToTimezone
}{wxdatetimetotimezone
} with
1626 the argument
{\tt GMT0
}.
1629 \membersection{wxDateTime::MakeUTC
}\label{wxdatetimemakeutc
}
1631 \func{wxDateTime\&
}{MakeUTC
}{\param{bool
}{noDST = false
}}
1633 This is the same as calling
\helpref{MakeTimezone
}{wxdatetimemaketimezone
} with
1634 the argument
{\tt GMT0
}.
1637 \membersection{wxDateTime::IsDST
}\label{wxdatetimeisdst
}
1639 \constfunc{int
}{IsDST
}{\param{Country
}{country = Country
\_Default}}
1641 Returns
{\tt true
} if the DST is applied for this date in the given country.
1643 \wxheading{See also
}
1645 \helpref{GetBeginDST
}{wxdatetimegetbegindst
} and
1646 \helpref{GetEndDST
}{wxdatetimegetenddst
}
1648 \section{\class{wxDateTimeHolidayAuthority
}}\label{wxdatetimeholidayauthority
}
1650 \wxheading{Derived from
}
1654 \wxheading{Include files
}
1660 \helpref{wxBase
}{librarieslist
}
1662 \latexignore{\rtfignore{\wxheading{Members
}}}
1666 \section{\class{wxDateTimeWorkDays
}}\label{wxdatetimeworkdays
}
1668 \wxheading{Derived from
}
1672 \wxheading{Include files
}
1678 \helpref{wxBase
}{librarieslist
}
1680 \latexignore{\rtfignore{\wxheading{Members
}}}