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 followign
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
}}}
183 \membersection{Static functions
}
185 For convenience, all static functions are collected here. These functions
186 either set or return the static variables of wxDateSpan (the country), return
187 the current moment, year, month or number of days in it, or do some general
188 calendar-related actions.
190 Please note that although several function accept an extra
{\it Calendar
}
191 parameter, it is currently ignored as only the Gregorian calendar is
192 supported. Future versions will support other calendars.
194 \pythonnote{These methods are standalone functions named
195 {\tt wxDateTime
\_<StaticMethodName>
} in wxPython.
}
197 \helpref{SetCountry
}{wxdatetimesetcountry
}\\
198 \helpref{GetCountry
}{wxdatetimegetcountry
}\\
199 \helpref{IsWestEuropeanCountry
}{wxdatetimeiswesteuropeancountry
}\\
200 \helpref{GetCurrentYear
}{wxdatetimegetcurrentyear
}\\
201 \helpref{ConvertYearToBC
}{wxdatetimeconvertyeartobc
}\\
202 \helpref{GetCurrentMonth
}{wxdatetimegetcurrentmonth
}\\
203 \helpref{IsLeapYear
}{wxdatetimeisleapyear
}\\
204 \helpref{GetCentury
}{wxdatetimegetcentury
}\\
205 \helpref{GetNumberOfDays
}{wxdatetimegetnumberofdays
}\\
206 \helpref{GetNumberOfDays
}{wxdatetimegetnumberofdays
}\\
207 \helpref{GetMonthName
}{wxdatetimegetmonthname
}\\
208 \helpref{GetWeekDayName
}{wxdatetimegetweekdayname
}\\
209 \helpref{GetAmPmStrings
}{wxdatetimegetampmstrings
}\\
210 \helpref{IsDSTApplicable
}{wxdatetimeisdstapplicable
}\\
211 \helpref{GetBeginDST
}{wxdatetimegetbegindst
}\\
212 \helpref{GetEndDST
}{wxdatetimegetenddst
}\\
213 \helpref{Now
}{wxdatetimenow
}\\
214 \helpref{UNow
}{wxdatetimeunow
}\\
215 \helpref{Today
}{wxdatetimetoday
}
217 \membersection{Constructors, assignment operators and setters
}
219 Constructors and various
{\tt Set()
} methods are collected here. If you
220 construct a date object from separate values for day, month and year, you
221 should use
\helpref{IsValid
}{wxdatetimeisvalid
} method to check that the
222 values were correct as constructors can not return an error code.
224 \helpref{wxDateTime()
}{wxdatetimewxdatetimedef
}\\
225 \helpref{wxDateTime(time
\_t)
}{wxdatetimewxdatetimetimet
}\\
226 \helpref{wxDateTime(struct tm)
}{wxdatetimewxdatetimetm
}\\
227 %\helpref{wxDateTime(struct Tm)}{wxdatetimewxdatetimetm} - Tm not documented yet\\
228 \helpref{wxDateTime(double jdn)
}{wxdatetimewxdatetimejdn
}\\
229 \helpref{wxDateTime(h, m, s, ms)
}{wxdatetimewxdatetimetime
}\\
230 \helpref{wxDateTime(day, mon, year, h, m, s, ms)
}{wxdatetimewxdatetimedate
}\\
231 \helpref{SetToCurrent
}{wxdatetimesettocurrent
}\\
232 \helpref{Set(time
\_t)
}{wxdatetimesettimet
}\\
233 \helpref{Set(struct tm)
}{wxdatetimesettm
}\\
234 %\helpref{Set(struct Tm)}{wxdatetimesettm} - Tm not documented yet\\
235 \helpref{Set(double jdn)
}{wxdatetimesetjdn
}\\
236 \helpref{Set(h, m, s, ms)
}{wxdatetimesettime
}\\
237 \helpref{Set(day, mon, year, h, m, s, ms)
}{wxdatetimesetdate
}\\
238 \helpref{SetFromDOS(unsigned long ddt)
}{wxdatetimesetfromdos
}\\
239 \helpref{ResetTime
}{wxdatetimeresettime
}\\
240 \helpref{SetYear
}{wxdatetimesetyear
}\\
241 \helpref{SetMonth
}{wxdatetimesetmonth
}\\
242 \helpref{SetDay
}{wxdatetimesetdate
}\\
243 \helpref{SetHour
}{wxdatetimesethour
}\\
244 \helpref{SetMinute
}{wxdatetimesetminute
}\\
245 \helpref{SetSecond
}{wxdatetimesetsecond
}\\
246 \helpref{SetMillisecond
}{wxdatetimesetmillisecond
}\\
247 \helpref{operator$=$(time
\_t)
}{wxdatetimeoperatoreqtimet
}\\
248 \helpref{operator$=$(struct tm)
}{wxdatetimeoperatoreqtm
}
249 %\helpref{operator$=$(struct Tm)}{wxdatetimeoperatortm2}
251 \membersection{Accessors
}
253 Here are the trivial accessors. Other functions, which might have to perform
254 some more complicated calculations to find the answer are under the
255 \helpref{Calendar calculations
}{wxdatetimecalculations
} section.
257 \helpref{IsValid
}{wxdatetimeisvalid
}\\
258 \helpref{GetTicks
}{wxdatetimegetticks
}\\
259 \helpref{GetYear
}{wxdatetimegetyear
}\\
260 \helpref{GetMonth
}{wxdatetimegetmonth
}\\
261 \helpref{GetDay
}{wxdatetimegetday
}\\
262 \helpref{GetWeekDay
}{wxdatetimegetweekday
}\\
263 \helpref{GetHour
}{wxdatetimegethour
}\\
264 \helpref{GetMinute
}{wxdatetimegetminute
}\\
265 \helpref{GetSecond
}{wxdatetimegetsecond
}\\
266 \helpref{GetMillisecond
}{wxdatetimegetmillisecond
}\\
267 \helpref{GetDayOfYear
}{wxdatetimegetdayofyear
}\\
268 \helpref{GetWeekOfYear
}{wxdatetimegetweekofyear
}\\
269 \helpref{GetWeekOfMonth
}{wxdatetimegetweekofmonth
}\\
270 \helpref{GetYearDay
}{wxdatetimegetyearday
}\\
271 \helpref{IsWorkDay
}{wxdatetimeisworkday
}\\
272 \helpref{IsGregorianDate
}{wxdatetimeisgregoriandate
}\\
273 \helpref{GetAsDOS
}{wxdatetimegetasdos
}
275 \membersection{Date comparison
}
277 There are several function to allow date comparison. To supplement them, a few
278 global operators $>$, $<$ etc taking wxDateTime are defined.
280 \helpref{IsEqualTo
}{wxdatetimeisequalto
}\\
281 \helpref{IsEarlierThan
}{wxdatetimeisearlierthan
}\\
282 \helpref{IsLaterThan
}{wxdatetimeislaterthan
}\\
283 \helpref{IsStrictlyBetween
}{wxdatetimeisstrictlybetween
}\\
284 \helpref{IsBetween
}{wxdatetimeisbetween
}\\
285 \helpref{IsSameDate
}{wxdatetimeissamedate
}\\
286 \helpref{IsSameTime
}{wxdatetimeissametime
}\\
287 \helpref{IsEqualUpTo
}{wxdatetimeisequalupto
}
289 \membersection{Date arithmetics
}
291 These functions carry out
\helpref{arithmetics
}{tdatearithm
} on the wxDateTime
292 objects. As explained in the overview, either wxTimeSpan or wxDateSpan may be
293 added to wxDateTime, hence all functions are overloaded to accept both
296 Also, both
{\tt Add()
} and
{\tt Subtract()
} have both const and non-const
297 version. The first one returns a new obejct which represents the
298 sum/difference of the original one with the argument while the second form
299 modifies the object to which it is applied. The operators $-=$ and $+=$ are
300 defined to be equivalent to the second forms of these functions.
302 \helpref{Add(wxTimeSpan)
}{wxdatetimeaddts
}\\
303 \helpref{Add(wxDateSpan)
}{wxdatetimeaddds
}\\
304 \helpref{Subtract(wxTimeSpan)
}{wxdatetimesubtractts
}\\
305 \helpref{Subtract(wxDateSpan)
}{wxdatetimesubtractds
}\\
306 \helpref{Subtract(wxDateTime)
}{wxdatetimesubtractdt
}\\
307 \helpref{oparator$+=$(wxTimeSpan)
}{wxdatetimeaddts
}\\
308 \helpref{oparator$+=$(wxDateSpan)
}{wxdatetimeaddds
}\\
309 \helpref{oparator$-=$(wxTimeSpan)
}{wxdatetimesubtractts
}\\
310 \helpref{oparator$-=$(wxDateSpan)
}{wxdatetimesubtractds
}
312 \membersection{Parsing and formatting dates
}
314 These functions convert wxDateTime obejcts to and from text. The
315 conversions to text are mostly trivial: you can either do it using the default
316 date and time representations for the current locale (
317 \helpref{FormatDate
}{wxdatetimeformatdate
} and
318 \helpref{FormatTime
}{wxdatetimeformattime
}), using the international standard
319 representation defined by ISO
8601 (
320 \helpref{FormatISODate
}{wxdatetimeformatisodate
} and
321 \helpref{FormatISOTime
}{wxdatetimeformatisotime
}) or by specifying any format
322 at all and using
\helpref{Format
}{wxdatetimeformat
} directly.
324 The conversions from text are more interesting, as there are much more
325 possibilities to care about. The simplest cases can be taken care of with
326 \helpref{ParseFormat
}{wxdatetimeparseformat
} which can parse any date in the
327 given (rigid) format.
\helpref{ParseRfc822Date
}{wxdatetimeparserfc822date
} is
328 another function for parsing dates in predefined format -- the one of RFC
822
329 which (still...) defines the format of email messages on the Internet. This
330 format can not be described with
{\tt strptime(
3)
}-like format strings used by
331 \helpref{Format
}{wxdatetimeformat
}, hence the need for a separate function.
333 But the most interesting functions are
334 \helpref{ParseTime
}{wxdatetimeparsetime
},
335 \helpref{ParseDate
}{wxdatetimeparsedate
} and
336 \helpref{ParseDateTime
}{wxdatetimeparsedatetime
}. They try to parse the date
337 ans time (or only one of them) in `free' format, i.e. allow them to be
338 specified in any of possible ways. These functions will usually be used to
339 parse the (interactive) user input which is not bound to be in any predefined
340 format. As an example,
\helpref{ParseDateTime
}{wxdatetimeparsedatetime
} can
341 parse the strings such as
{\tt "tomorrow"
},
{\tt "March first"
} and even
344 \helpref{ParseRfc822Date
}{wxdatetimeparserfc822date
}\\
345 \helpref{ParseFormat
}{wxdatetimeparseformat
}\\
346 \helpref{ParseDateTime
}{wxdatetimeparsedatetime
}\\
347 \helpref{ParseDate
}{wxdatetimeparsedate
}\\
348 \helpref{ParseTime
}{wxdatetimeparsetime
}\\
349 \helpref{Format
}{wxdatetimeformat
}\\
350 \helpref{FormatDate
}{wxdatetimeformatdate
}\\
351 \helpref{FormatTime
}{wxdatetimeformattime
}\\
352 \helpref{FormatISODate
}{wxdatetimeformatisodate
}\\
353 \helpref{FormatISOTime
}{wxdatetimeformatisotime
}
355 \membersection{Calendar calculations
}\label{wxdatetimecalculations
}
357 The functions in this section perform the basic calendar calculations, mostly
358 related to the week days. They allow to find the given week day in the
359 week with given number (either in the month or in the year) and so on.
361 All (non-const) functions in this section don't modify the time part of the
362 wxDateTime -- they only work with the date part of it.
364 \helpref{SetToWeekDayInSameWeek
}{wxdatetimesettoweekdayinsameweek
}\\
365 \helpref{GetWeekDayInSameWeek
}{wxdatetimegetweekdayinsameweek
}\\
366 \helpref{SetToNextWeekDay
}{wxdatetimesettonextweekday
}\\
367 \helpref{GetNextWeekDay
}{wxdatetimegetnextweekday
}\\
368 \helpref{SetToPrevWeekDay
}{wxdatetimesettoprevweekday
}\\
369 \helpref{GetPrevWeekDay
}{wxdatetimegetprevweekday
}\\
370 \helpref{SetToWeekDay
}{wxdatetimesettoweekday
}\\
371 \helpref{GetWeekDay
}{wxdatetimegetweekday2
}\\
372 \helpref{SetToLastWeekDay
}{wxdatetimesettolastweekday
}\\
373 \helpref{GetLastWeekDay
}{wxdatetimegetlastweekday
}\\
374 \helpref{SetToTheWeek
}{wxdatetimesettotheweek
}\\
375 \helpref{GetWeek
}{wxdatetimegetweek
}\\
376 \helpref{SetToLastMonthDay
}{wxdatetimesettolastmonthday
}\\
377 \helpref{GetLastMonthDay
}{wxdatetimegetlastmonthday
}\\
378 \helpref{SetToYearDay
}{wxdatetimesettoyearday
}\\
379 \helpref{GetYearDay
}{wxdatetimegetyearday
}
381 \membersection{Astronomical/historical functions
}
383 Some degree of support for the date units used in astronomy and/or history is
384 provided. You can construct a wxDateTime object from a
385 \helpref{JDN
}{wxdatetimesetjdn
} and you may also get its JDN,
386 \helpref{MJD
}{wxdatetimegetmodifiedjuliandaynumber
} or
387 \helpref{Rata Die number
}{wxdatetimegetratadie
} from it.
389 \helpref{wxDateTime(double jdn)
}{wxdatetimewxdatetimejdn
}\\
390 \helpref{Set(double jdn)
}{wxdatetimesetjdn
}\\
391 \helpref{GetJulianDayNumber
}{wxdatetimegetjuliandaynumber
}\\
392 \helpref{GetJDN
}{wxdatetimegetjdn
}\\
393 \helpref{GetModifiedJulianDayNumber
}{wxdatetimegetmodifiedjuliandaynumber
}\\
394 \helpref{GetMJD
}{wxdatetimegetmjd
}\\
395 \helpref{GetRataDie
}{wxdatetimegetratadie
}
397 \membersection{Time zone and DST support
}
399 Please see the
\helpref{time zone overview
}{tdatetimezones
} for more
400 information about time zones. ormally, these functions should be rarely used.
402 \helpref{ToTimezone
}{wxdatetimetotimezone
}\\
403 \helpref{MakeTimezone
}{wxdatetimemaketimezone
}\\
404 \helpref{ToGMT
}{wxdatetimetogmt
}\\
405 \helpref{MakeGMT
}{wxdatetimemakegmt
}\\
406 \helpref{GetBeginDST
}{wxdatetimegetbegindst
}\\
407 \helpref{GetEndDST
}{wxdatetimegetenddst
}\\
408 \helpref{IsDST
}{wxdatetimeisdst
}
410 \helponly{\insertatlevel{2}{
416 %%%%%%%%%%%%%%%%%%%%%%%%%%% static functions %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
418 \membersection{wxDateTime::ConvertYearToBC
}\label{wxdatetimeconvertyeartobc
}
420 \func{static int
}{ConvertYearToBC
}{\param{int
}{year
}}
422 Converts the year in absolute notation (i.e. a number which can be negative,
423 positive or zero) to the year in BC/AD notation. For the positive years,
424 nothing is done, but the year
0 is year
1 BC and so for other years there is a
427 This function should be used like this:
431 int y = dt.GetYear();
432 printf("The year is
%d%s", wxDateTime::ConvertYearToBC(y), y > 0 ? "AD" : "BC");
435 \membersection{wxDateTime::GetAmPmStrings
}\label{wxdatetimegetampmstrings
}
437 \func{static void
}{GetAmPmStrings
}{\param{wxString *
}{am
},
\param{wxString *
}{pm
}}
439 Returns the translations of the strings
{\tt AM
} and
{\tt PM
} used for time
440 formatting for the current locale. Either of the pointers may be
{\tt NULL
} if
441 the corresponding value is not needed.
443 \membersection{wxDateTime::GetBeginDST
}\label{wxdatetimegetbegindst
}
445 \func{static wxDateTime
}{GetBeginDST
}{\param{int
}{year = Inv
\_Year},
\param{Country
}{country = Country
\_Default}}
447 Get the beginning of DST for the given country in the given year (current one
448 by default). This function suffers from limitations described in
449 \helpref{DST overview
}{tdatedst
}.
453 \helpref{GetEndDST
}{wxdatetimegetenddst
}
455 \membersection{wxDateTime::GetCountry
}\label{wxdatetimegetcountry
}
457 \func{static Country
}{GetCountry
}{\void}
459 Returns the current default country. The default country is used for DST
460 calculations, for example.
464 \helpref{SetCountry
}{wxdatetimesetcountry
}
466 \membersection{wxDateTime::GetCurrentYear
}\label{wxdatetimegetcurrentyear
}
468 \func{static int
}{GetCurrentYear
}{\param{Calendar
}{cal = Gregorian
}}
470 Get the current year in given calendar (only Gregorian is currently supported).
472 \membersection{wxDateTime::GetCurrentMonth
}\label{wxdatetimegetcurrentmonth
}
474 \func{static Month
}{GetCurrentMonth
}{\param{Calendar
}{cal = Gregorian
}}
476 Get the current month in given calendar (only Gregorian is currently supported).
478 \membersection{wxDateTime::GetCentury
}\label{wxdatetimegetcentury
}
480 \func{static int
}{GetCentury
}{\param{int
}{year = Inv
\_Year}}
482 Get the current century, i.e. first two digits of the year, in given calendar
483 (only Gregorian is currently supported).
485 \membersection{wxDateTime::GetEndDST
}\label{wxdatetimegetenddst
}
487 \func{static wxDateTime
}{GetEndDST
}{\param{int
}{year = Inv
\_Year},
\param{Country
}{country = Country
\_Default}}
489 Returns the end of DST for the given country in the given year (current one by
494 \helpref{GetBeginDST
}{wxdatetimegetbegindst
}
496 \membersection{wxDateTime::GetMonthName
}\label{wxdatetimegetmonthname
}
498 \func{static wxString
}{GetMonthName
}{\param{Month
}{month
},
\param{NameFlags
}{flags = Name
\_Full}}
500 Gets the full (default) or abbreviated (specify
{\tt Name
\_Abbr} name of the
505 \helpref{GetWeekDayName
}{wxdatetimegetweekdayname
}
507 \membersection{wxDateTime::GetNumberOfDays
}\label{wxdatetimegetnumberofdays
}
509 \func{static wxDateTime
\_t}{GetNumberOfDays
}{\param{int
}{year
},
\param{Calendar
}{cal = Gregorian
}}
511 \func{static wxDateTime
\_t}{GetNumberOfDays
}{\param{Month
}{month
},
\param{int
}{year = Inv
\_Year},
\param{Calendar
}{cal = Gregorian
}}
513 Returns the number of days in the given year or in the given month of the
516 The only supported value for
{\it cal
} parameter is currently
{\tt Gregorian
}.
518 \pythonnote{These two methods are named
{\tt GetNumberOfDaysInYear
}
519 and
{\tt GetNumberOfDaysInMonth
} in wxPython.
}
521 \membersection{wxDateTime::GetWeekDayName
}\label{wxdatetimegetweekdayname
}
523 \func{static wxString
}{GetWeekDayName
}{\param{WeekDay
}{weekday
},
\param{NameFlags
}{flags = Name
\_Full}}
525 Gets the full (default) or abbreviated (specify
{\tt Name
\_Abbr} name of the
530 \helpref{GetMonthName
}{wxdatetimegetmonthname
}
532 \membersection{wxDateTime::IsLeapYear
}\label{wxdatetimeisleapyear
}
534 \func{static bool
}{IsLeapYear
}{\param{int
}{year = Inv
\_Year},
\param{Calendar
}{cal = Gregorian
}}
536 Returns
{\tt true
} if the
{\it year
} is a leap one in the specified calendar.
538 This functions supports Gregorian and Julian calendars.
540 \membersection{wxDateTime::IsWestEuropeanCountry
}\label{wxdatetimeiswesteuropeancountry
}
542 \func{static bool
}{IsWestEuropeanCountry
}{\param{Country
}{country = Country
\_Default}}
544 This function returns
{\tt true
} if the specified (or default) country is one
545 of Western European ones. It is used internally by wxDateTime to determine the
546 DST convention and date and time formatting rules.
548 \membersection{wxDateTime::IsDSTApplicable
}\label{wxdatetimeisdstapplicable
}
550 \func{static bool
}{IsDSTApplicable
}{\param{int
}{year = Inv
\_Year},
\param{Country
}{country = Country
\_Default}}
552 Returns
{\tt true
} if DST was used n the given year (the current one by
553 default) in the given country.
555 \membersection{wxDateTime::Now
}\label{wxdatetimenow
}
557 \func{static wxDateTime
}{Now
}{\void}
559 Returns the object corresponding to the current time.
564 wxDateTime now = wxDateTime::Now();
565 printf("Current time in Paris:
\t%s\n", now.Format("%c", wxDateTime::CET).c_str());
568 Note that this function is accurate up to second:
569 \helpref{wxDateTime::UNow
}{wxdatetimeunow
} should be used for better precision
570 (but it is less efficient and might not be available on all platforms).
574 \helpref{Today
}{wxdatetimetoday
}
576 \membersection{wxDateTime::SetCountry
}\label{wxdatetimesetcountry
}
578 \func{static void
}{SetCountry
}{\param{Country
}{country
}}
580 Sets the country to use by default. This setting influences the DST
581 calculations, date formatting and other things.
583 The possible values for
{\it country
} parameter are enumerated in
584 \helpref{wxDateTime constants section
}{wxdatetime
}.
588 \helpref{GetCountry
}{wxdatetimegetcountry
}
590 \membersection{wxDateTime::Today
}\label{wxdatetimetoday
}
592 \func{static wxDateTime
}{Today
}{\void}
594 Returns the object corresponding to the midnight of the current day (i.e. the
595 same as
\helpref{Now()
}{wxdatetimenow
}, but the time part is set to $
0$).
599 \helpref{Now
}{wxdatetimenow
}
601 \membersection{wxDateTime::UNow
}\label{wxdatetimeunow
}
603 \func{static wxDateTime
}{UNow
}{\void}
605 Returns the object corresponding to the current time including the
606 milliseconds if a function to get time with such precision is available on the
607 current platform (supported under most Unices and Win32).
611 \helpref{Now
}{wxdatetimenow
}
613 %%%%%%%%%%%%%%%%%%%%%%%%%%% constructors &c %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
615 \membersection{wxDateTime::wxDateTime
}\label{wxdatetimewxdatetimedef
}
617 \func{}{wxDateTime
}{\void}
619 Default constructor. Use one of
{\tt Set()
} functions to initialize the object
622 \membersection{wxDateTime::wxDateTime
}\label{wxdatetimewxdatetimetimet
}
624 \func{wxDateTime\&
}{wxDateTime
}{\param{time
\_t }{timet
}}
626 Same as
\helpref{Set
}{wxdatetimewxdatetimetimet
}.
628 \pythonnote{This constructor is named
{\tt wxDateTimeFromTimeT
} in wxPython.
}
630 \membersection{wxDateTime::wxDateTime
}\label{wxdatetimewxdatetimetm
}
632 \func{wxDateTime\&
}{wxDateTime
}{\param{const struct tm\&
}{tm
}}
634 Same as
\helpref{Set
}{wxdatetimewxdatetimetm
}
636 \pythonnote{Unsupported.
}
638 \membersection{wxDateTime::wxDateTime
}\label{wxdatetimewxdatetimejdn
}
640 \func{wxDateTime\&
}{wxDateTime
}{\param{double
}{jdn
}}
642 Same as
\helpref{Set
}{wxdatetimewxdatetimejdn
}
644 \pythonnote{This constructor is named
{\tt wxDateTimeFromJDN
} in wxPython.
}
646 \membersection{wxDateTime::wxDateTime
}\label{wxdatetimewxdatetimetime
}
648 \func{wxDateTime\&
}{wxDateTime
}{\param{wxDateTime
\_t }{hour
},
\param{wxDateTime
\_t }{minute =
0},
\param{wxDateTime
\_t }{second =
0},
\param{wxDateTime
\_t }{millisec =
0}}
650 Same as
\helpref{Set
}{wxdatetimewxdatetimetime
}
652 \pythonnote{This constructor is named
{\tt wxDateTimeFromHMS
} in wxPython.
}
654 \membersection{wxDateTime::wxDateTime
}\label{wxdatetimewxdatetimedate
}
656 \func{wxDateTime\&
}{wxDateTime
}{\param{wxDateTime
\_t }{day
},
\param{Month
}{month = Inv
\_Month},
\param{int
}{ Inv
\_Year},
657 \param{wxDateTime
\_t }{hour =
0},
\param{wxDateTime
\_t }{minute =
0},
\param{wxDateTime
\_t }{second =
0},
\param{wxDateTime
\_t }{millisec =
0}}
659 Same as
\helpref{Set
}{wxdatetimesetdate
}
661 \pythonnote{This constructor is named
{\tt wxDateTimeFromDMY
} in wxPython.
}
663 \membersection{wxDateTime::SetToCurrent
}\label{wxdatetimesettocurrent
}
665 \func{wxDateTime\&
}{SetToCurrent
}{\void}
667 Sets the date and time of to the current values. Same as assigning the result
668 of
\helpref{Now()
}{wxdatetimenow
} to this object.
670 \membersection{wxDateTime::Set
}\label{wxdatetimesettimet
}
672 \func{wxDateTime\&
}{Set
}{\param{time
\_t }{timet
}}
674 Constructs the object from
{\it timet
} value holding the number of seconds
677 \pythonnote{This method is named
{\tt SetTimeT
} in wxPython.
}
679 \membersection{wxDateTime::Set
}\label{wxdatetimesettm
}
681 \func{wxDateTime\&
}{Set
}{\param{const struct tm\&
}{tm
}}
683 Sets the date and time from the broken down representation in the standard
686 \pythonnote{Unsupported.
}
688 \membersection{wxDateTime::Set
}\label{wxdatetimesetjdn
}
690 \func{wxDateTime\&
}{Set
}{\param{double
}{jdn
}}
692 Sets the date from the so-called
{\it Julian Day Number
}.
694 By definition, the Julian Day Number, usually abbreviated as JDN, of a
695 particular instant is the fractional number of days since
12 hours Universal
696 Coordinated Time (Greenwich mean noon) on January
1 of the year -
4712 in the
697 Julian proleptic calendar.
699 \pythonnote{This method is named
{\tt SetJDN
} in wxPython.
}
701 \membersection{wxDateTime::Set
}\label{wxdatetimesettime
}
703 \func{wxDateTime\&
}{Set
}{\param{wxDateTime
\_t }{hour
},
\param{wxDateTime
\_t }{minute =
0},
\param{wxDateTime
\_t }{second =
0},
\param{wxDateTime
\_t }{millisec =
0}}
705 Sets the date to be equal to
\helpref{Today
}{wxdatetimetoday
} and the time
706 from supplied parameters.
708 \pythonnote{This method is named
{\tt SetHMS
} in wxPython.
}
710 \membersection{wxDateTime::Set
}\label{wxdatetimesetdate
}
712 \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}}
714 Sets the date and time from the parameters.
716 \membersection{wxDateTime::ResetTime
}\label{wxdatetimeresettime
}
718 \func{wxDateTime\&
}{ResetTime
}{\void}
720 Reset time to midnight (
00:
00:
00) without changing the date.
722 \membersection{wxDateTime::SetYear
}\label{wxdatetimesetyear
}
724 \func{wxDateTime\&
}{SetYear
}{\param{int
}{year
}}
726 Sets the year without changing other date components.
728 \membersection{wxDateTime::SetMonth
}\label{wxdatetimesetmonth
}
730 \func{wxDateTime\&
}{SetMonth
}{\param{Month
}{month
}}
732 Sets the month without changing other date components.
734 \membersection{wxDateTime::SetDay
}\label{wxdatetimesetday
}
736 \func{wxDateTime\&
}{SetDay
}{\param{wxDateTime
\_t }{day
}}
738 Sets the day without changing other date components.
740 \membersection{wxDateTime::SetHour
}\label{wxdatetimesethour
}
742 \func{wxDateTime\&
}{SetHour
}{\param{wxDateTime
\_t }{hour
}}
744 Sets the hour without changing other date components.
746 \membersection{wxDateTime::SetMinute
}\label{wxdatetimesetminute
}
748 \func{wxDateTime\&
}{SetMinute
}{\param{wxDateTime
\_t }{minute
}}
750 Sets the minute without changing other date components.
752 \membersection{wxDateTime::SetSecond
}\label{wxdatetimesetsecond
}
754 \func{wxDateTime\&
}{SetSecond
}{\param{wxDateTime
\_t }{second
}}
756 Sets the second without changing other date components.
758 \membersection{wxDateTime::SetMillisecond
}\label{wxdatetimesetmillisecond
}
760 \func{wxDateTime\&
}{SetMillisecond
}{\param{wxDateTime
\_t }{millisecond
}}
762 Sets the millisecond without changing other date components.
764 \membersection{wxDateTime::operator$=$
}\label{wxdatetimeoperatoreqtimet
}
766 \func{wxDateTime\&
}{operator
}{\param{time
\_t }{timet
}}
768 Same as
\helpref{Set
}{wxdatetimesettimet
}.
770 \membersection{wxDateTime::operator$=$
}\label{wxdatetimeoperatoreqtm
}
772 \func{wxDateTime\&
}{operator
}{\param{const struct tm\&
}{tm
}}
774 Same as
\helpref{Set
}{wxdatetimesettm
}.
776 %%%%%%%%%%%%%%%%%%%%%%%%%%% accessors %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
778 \membersection{wxDateTime::IsValid
}\label{wxdatetimeisvalid
}
780 \constfunc{bool
}{IsValid
}{\void}
782 Returns
{\tt true
} if the object represents a valid time moment.
784 \membersection{wxDateTime::GetTm
}\label{wxdatetimegettm
}
786 \constfunc{Tm
}{GetTm
}{\param{const TimeZone\&
}{tz = Local
}}
788 Returns broken down representation of the date and time.
790 \membersection{wxDateTime::GetTicks
}\label{wxdatetimegetticks
}
792 \constfunc{time
\_t}{GetTicks
}{\void}
794 Returns the number of seconds since Jan
1,
1970. An assert failure will occur
795 if the date is not in the range covered by
{\tt time
\_t} type.
797 \membersection{wxDateTime::GetYear
}\label{wxdatetimegetyear
}
799 \constfunc{int
}{GetYear
}{\param{const TimeZone\&
}{tz = Local
}}
801 Returns the year in the given timezone (local one by default).
803 \membersection{wxDateTime::GetMonth
}\label{wxdatetimegetmonth
}
805 \constfunc{Month
}{GetMonth
}{\param{const TimeZone\&
}{tz = Local
}}
807 Returns the month in the given timezone (local one by default).
809 \membersection{wxDateTime::GetDay
}\label{wxdatetimegetday
}
811 \constfunc{wxDateTime
\_t}{GetDay
}{\param{const TimeZone\&
}{tz = Local
}}
813 Returns the day in the given timezone (local one by default).
815 \membersection{wxDateTime::GetWeekDay
}\label{wxdatetimegetweekday
}
817 \constfunc{WeekDay
}{GetWeekDay
}{\param{const TimeZone\&
}{tz = Local
}}
819 Returns the week day in the given timezone (local one by default).
821 \membersection{wxDateTime::GetHour
}\label{wxdatetimegethour
}
823 \constfunc{wxDateTime
\_t}{GetHour
}{\param{const TimeZone\&
}{tz = Local
}}
825 Returns the hour in the given timezone (local one by default).
827 \membersection{wxDateTime::GetMinute
}\label{wxdatetimegetminute
}
829 \constfunc{wxDateTime
\_t}{GetMinute
}{\param{const TimeZone\&
}{tz = Local
}}
831 Returns the minute in the given timezone (local one by default).
833 \membersection{wxDateTime::GetSecond
}\label{wxdatetimegetsecond
}
835 \constfunc{wxDateTime
\_t}{GetSecond
}{\param{const TimeZone\&
}{tz = Local
}}
837 Returns the seconds in the given timezone (local one by default).
839 \membersection{wxDateTime::GetMillisecond
}\label{wxdatetimegetmillisecond
}
841 \constfunc{wxDateTime
\_t}{GetMillisecond
}{\param{const TimeZone\&
}{tz = Local
}}
843 Returns the milliseconds in the given timezone (local one by default).
845 \membersection{wxDateTime::GetDayOfYear
}\label{wxdatetimegetdayofyear
}
847 \constfunc{wxDateTime
\_t}{GetDayOfYear
}{\param{const TimeZone\&
}{tz = Local
}}
849 Returns the day of the year (in $
1\ldots366$ range) in the given timezone
850 (local one by default).
852 \membersection{wxDateTime::GetWeekOfYear
}\label{wxdatetimegetweekofyear
}
854 \constfunc{wxDateTime
\_t}{GetWeekOfYear
}{\param{WeekFlags
}{flags = Monday
\_First},
\param{const TimeZone\&
}{tz = Local
}}
856 Returns the number of the week of the year this date is in. The first week of
857 the year is, according to international standards, the one containing Jan
4.
858 The week number is in $
1\ldots53$ range ($
52$ for non leap years).
860 The function depends on the
\helpref{week start
}{wxdatetime
} convention
861 specified by the
{\it flags
} argument.
863 \membersection{wxDateTime::GetWeekOfMonth
}\label{wxdatetimegetweekofmonth
}
865 \constfunc{wxDateTime
\_t}{GetWeekOfMonth
}{\param{WeekFlags
}{flags = Monday
\_First},
\param{const TimeZone\&
}{tz = Local
}}
867 Returns the ordinal number of the week in the month (in $
1\ldots5$ range).
869 As
\helpref{GetWeekOfYear
}{wxdatetimegetweekofyear
}, this function supports
870 both conventions for the week start. See the description of these
871 \helpref{week start
}{wxdatetime
} conventions.
873 \membersection{wxDateTime::IsWorkDay
}\label{wxdatetimeisworkday
}
875 \constfunc{bool
}{IsWorkDay
}{\param{Country
}{country = Country
\_Default}}
877 Returns
{\tt true
} is this day is not a holiday in the given country.
879 \membersection{wxDateTime::IsGregorianDate
}\label{wxdatetimeisgregoriandate
}
881 \constfunc{bool
}{IsGregorianDate
}{\param{GregorianAdoption
}{country = Gr
\_Standard}}
883 Returns
{\tt true
} if the given date os later than the date of adoption of the
884 Gregorian calendar in the given country (and hence the Gregorian calendar
885 calculations make sense for it).
887 %%%%%%%%%%%%%%%%%%%%%% dos date and time format %%%%%%%%%%%%%%%%%%%%%%%
889 \membersection{wxDateTime::SetFromDOS
}\label{wxdatetimesetfromdos
}
891 \func{wxDateTime\&
}{Set
}{\param{unsigned long
}{ddt
}}
893 Sets the date from the date and time in
894 \urlref{DOS
}{http://developer.novell.com/ndk/doc/smscomp/index.html?page=/ndk/doc/smscomp/sms
\_docs/data/hc2vlu5i.html
}
897 \membersection{wxDateTime::GetAsDOS
}\label{wxdatetimegetasdos
}
899 \constfunc{unsigned long
}{GetAsDOS
}{\void}
901 Returns the date and time in
902 \urlref{DOS
}{http://developer.novell.com/ndk/doc/smscomp/index.html?page=/ndk/doc/smscomp/sms
\_docs/data/hc2vlu5i.html
}
905 %%%%%%%%%%%%%%%%%%%%%%%%%%% comparison %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
907 \membersection{wxDateTime::IsEqualTo
}\label{wxdatetimeisequalto
}
909 \constfunc{bool
}{IsEqualTo
}{\param{const wxDateTime\&
}{datetime
}}
911 Returns
{\tt true
} if the two dates are strictly identical.
913 \membersection{wxDateTime::IsEarlierThan
}\label{wxdatetimeisearlierthan
}
915 \constfunc{bool
}{IsEarlierThan
}{\param{const wxDateTime\&
}{datetime
}}
917 Returns
{\tt true
} if this date precedes the given one.
919 \membersection{wxDateTime::IsLaterThan
}\label{wxdatetimeislaterthan
}
921 \constfunc{bool
}{IsLaterThan
}{\param{const wxDateTime\&
}{datetime
}}
923 Returns
{\tt true
} if this date is later than the given one.
925 \membersection{wxDateTime::IsStrictlyBetween
}\label{wxdatetimeisstrictlybetween
}
927 \constfunc{bool
}{IsStrictlyBetween
}{\param{const wxDateTime\&
}{t1
},
\param{const wxDateTime\&
}{t2
}}
929 Returns
{\tt true
} if this date lies strictly between the two others,
933 \helpref{IsBetween
}{wxdatetimeisbetween
}
935 \membersection{wxDateTime::IsBetween
}\label{wxdatetimeisbetween
}
937 \constfunc{bool
}{IsBetween
}{\param{const wxDateTime\&
}{t1
},
\param{const wxDateTime\&
}{t2
}}
939 Returns
{\tt true
} if
\helpref{IsStrictlyBetween
}{wxdatetimeisstrictlybetween
}
940 is
{\tt true
} or if the date is equal to one of the limit values.
944 \helpref{IsStrictlyBetween
}{wxdatetimeisstrictlybetween
}
946 \membersection{wxDateTime::IsSameDate
}\label{wxdatetimeissamedate
}
948 \constfunc{bool
}{IsSameDate
}{\param{const wxDateTime\&
}{dt
}}
950 Returns
{\tt true
} if the date is the same without comparing the time parts.
952 \membersection{wxDateTime::IsSameTime
}\label{wxdatetimeissametime
}
954 \constfunc{bool
}{IsSameTime
}{\param{const wxDateTime\&
}{dt
}}
956 Returns
{\tt true
} if the time is the same (although dates may differ).
958 \membersection{wxDateTime::IsEqualUpTo
}\label{wxdatetimeisequalupto
}
960 \constfunc{bool
}{IsEqualUpTo
}{\param{const wxDateTime\&
}{dt
},
\param{const wxTimeSpan\&
}{ts
}}
962 Returns
{\tt true
} if the date is equal to another one up to the given time
963 interval, i.e. if the absolute difference between the two dates is less than
966 %%%%%%%%%%%%%%%%%%%%%%%%%%% arithmetics %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
968 \membersection{wxDateTime::Add
}\label{wxdatetimeaddts
}
970 \constfunc{wxDateTime
}{Add
}{\param{const wxTimeSpan\&
}{diff
}}
972 \func{wxDateTime\&
}{Add
}{\param{const wxTimeSpan\&
}{diff
}}
974 \func{wxDateTime\&
}{operator$+=$
}{\param{const wxTimeSpan\&
}{diff
}}
976 Adds the given time span to this object.
978 \pythonnote{This method is named
{\tt AddTS
} in wxPython.
}
981 \membersection{wxDateTime::Add
}\label{wxdatetimeaddds
}
983 \constfunc{wxDateTime
}{Add
}{\param{const wxDateSpan\&
}{diff
}}
985 \func{wxDateTime\&
}{Add
}{\param{const wxDateSpan\&
}{diff
}}
987 \func{wxDateTime\&
}{operator$+=$
}{\param{const wxDateSpan\&
}{diff
}}
989 Adds the given date span to this object.
991 \pythonnote{This method is named
{\tt AddDS
} in wxPython.
}
994 \membersection{wxDateTime::Subtract
}\label{wxdatetimesubtractts
}
996 \constfunc{wxDateTime
}{Subtract
}{\param{const wxTimeSpan\&
}{diff
}}
998 \func{wxDateTime\&
}{Subtract
}{\param{const wxTimeSpan\&
}{diff
}}
1000 \func{wxDateTime\&
}{operator$-=$
}{\param{const wxTimeSpan\&
}{diff
}}
1002 Subtracts the given time span from this object.
1004 \pythonnote{This method is named
{\tt SubtractTS
} in wxPython.
}
1007 \membersection{wxDateTime::Subtract
}\label{wxdatetimesubtractds
}
1009 \constfunc{wxDateTime
}{Subtract
}{\param{const wxDateSpan\&
}{diff
}}
1011 \func{wxDateTime\&
}{Subtract
}{\param{const wxDateSpan\&
}{diff
}}
1013 \func{wxDateTime\&
}{operator$-=$
}{\param{const wxDateSpan\&
}{diff
}}
1015 Subtracts the given date span from this object.
1017 \pythonnote{This method is named
{\tt SubtractDS
} in wxPython.
}
1020 \membersection{wxDateTime::Subtract
}\label{wxdatetimesubtractdt
}
1022 \constfunc{wxTimeSpan
}{Subtract
}{\param{const wxDateTime\&
}{dt
}}
1024 Subtracts another date from this one and returns the difference between them
1027 %%%%%%%%%%%%%%%%%%%%%%%%%%% parsing/formatting %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1029 \membersection{wxDateTime::ParseRfc822Date
}\label{wxdatetimeparserfc822date
}
1031 \func{const wxChar *
}{ParseRfc822Date
}{\param{const wxChar*
}{date
}}
1033 Parses the string
{\it date
} looking for a date formatted according to the RFC
1034 822 in it. The exact description of this format may, of course, be found in
1035 the RFC (section $
5$), but, briefly, this is the format used in the headers of
1036 Internet email messages and one of the most common strings expressing date in
1037 this format may be something like
{\tt "Sat,
18 Dec
1999 00:
48:
30 +
0100"
}.
1039 Returns
{\tt NULL
} if the conversion failed, otherwise return the pointer to
1040 the character immediately following the part of the string which could be
1041 parsed. If the entire string contains only the date in RFC
822 format,
1042 the returned pointer will be pointing to a
{\tt NUL
} character.
1044 This function is intentionally strict, it will return an error for any string
1045 which is not RFC
822 compliant. If you need to parse date formatted in more
1046 free ways, you should use
\helpref{ParseDateTime
}{wxdatetimeparsedatetime
} or
1047 \helpref{ParseDate
}{wxdatetimeparsedate
} instead.
1049 \membersection{wxDateTime::ParseFormat
}\label{wxdatetimeparseformat
}
1051 \func{const wxChar *
}{ParseFormat
}{\param{const wxChar *
}{date
},
\param{const wxChar *
}{format = "\%c"
},
\param{const wxDateTime\&
}{dateDef = wxDefaultDateTime
}}
1053 This function parses the string
{\it date
} according to the given
1054 {\it format
}. The system
{\tt strptime(
3)
} function is used whenever available,
1055 but even if it is not, this function is still implemented, although support
1056 for locale-dependent format specifiers such as
{\tt "\%c"
},
{\tt "\%x"
} or
{\tt "\%X"
} may
1057 not be perfect and GNU extensions such as
{\tt "\%z"
} and
{\tt "\%Z"
} are
1058 not implemented. This function does handle the month and weekday
1059 names in the current locale on all platforms, however.
1061 Please see the description of the ANSI C function
{\tt strftime(
3)
} for the syntax
1062 of the format string.
1064 The
{\it dateDef
} parameter is used to fill in the fields which could not be
1065 determined from the format string. For example, if the format is
{\tt "\%d"
} (the
1066 ay of the month), the month and the year are taken from
{\it dateDef
}. If
1067 it is not specified,
\helpref{Today
}{wxdatetimetoday
} is used as the
1070 Returns
{\tt NULL
} if the conversion failed, otherwise return the pointer to
1071 the character which stopped the scan.
1073 \membersection{wxDateTime::ParseDateTime
}\label{wxdatetimeparsedatetime
}
1075 \func{const wxChar *
}{ParseDateTime
}{\param{const wxChar *
}{datetime
}}
1077 Parses the string
{\it datetime
} containing the date and time in free format.
1078 This function tries as hard as it can to interpret the given string as date
1079 and time. Unlike
\helpref{ParseRfc822Date
}{wxdatetimeparserfc822date
}, it
1080 will accept anything that may be accepted and will only reject strings which
1081 can not be parsed in any way at all.
1083 Returns
{\tt NULL
} if the conversion failed, otherwise return the pointer to
1084 the character which stopped the scan. This method is currently not
1085 implemented, so always returns NULL.
1087 \membersection{wxDateTime::ParseDate
}\label{wxdatetimeparsedate
}
1089 \func{const wxChar *
}{ParseDate
}{\param{const wxChar *
}{date
}}
1091 This function is like
\helpref{ParseDateTime
}{wxdatetimeparsedatetime
}, but it
1092 only allows the date to be specified. It is thus less flexible then
1093 \helpref{ParseDateTime
}{wxdatetimeparsedatetime
}, but also has less chances to
1094 misinterpret the user input.
1096 Returns
{\tt NULL
} if the conversion failed, otherwise return the pointer to
1097 the character which stopped the scan.
1099 \membersection{wxDateTime::ParseTime
}\label{wxdatetimeparsetime
}
1101 \func{const wxChar *
}{ParseTime
}{\param{const wxChar *
}{time
}}
1103 This functions is like
\helpref{ParseDateTime
}{wxdatetimeparsedatetime
}, but
1104 only allows the time to be specified in the input string.
1106 Returns
{\tt NULL
} if the conversion failed, otherwise return the pointer to
1107 the character which stopped the scan.
1109 \membersection{wxDateTime::Format
}\label{wxdatetimeformat
}
1111 \constfunc{wxString
}{Format
}{\param{const wxChar *
}{format = "\%c"
},
\param{const TimeZone\&
}{tz = Local
}}
1113 This function does the same as the standard ANSI C
{\tt strftime(
3)
} function.
1114 Please see its description for the meaning of
{\it format
} parameter.
1116 It also accepts a few wxWindows-specific extensions: you can optionally specify
1117 the width of the field to follow using
{\tt printf(
3)
}-like syntax and the
1118 format specification
{\tt \%l
} can be used to get the number of milliseconds.
1120 \wxheading{See also
}
1122 \helpref{ParseFormat
}{wxdatetimeparseformat
}
1124 \membersection{wxDateTime::FormatDate
}\label{wxdatetimeformatdate
}
1126 \constfunc{wxString
}{FormatDate
}{\void}
1128 Identical to calling
\helpref{Format()
}{wxdatetimeformat
} with
{\tt "\%x"
}
1129 argument (which means `preferred date representation for the current locale').
1131 \membersection{wxDateTime::FormatTime
}\label{wxdatetimeformattime
}
1133 \constfunc{wxString
}{FormatTime
}{\void}
1135 Identical to calling
\helpref{Format()
}{wxdatetimeformat
} with
{\tt "\%X"
}
1136 argument (which means `preferred time representation for the current locale').
1138 \membersection{wxDateTime::FormatISODate
}\label{wxdatetimeformatisodate
}
1140 \constfunc{wxString
}{FormatISODate
}{\void}
1142 This function returns the date representation in the ISO
8601 format
1145 \membersection{wxDateTime::FormatISOTime
}\label{wxdatetimeformatisotime
}
1147 \constfunc{wxString
}{FormatISOTime
}{\void}
1149 This function returns the time representation in the ISO
8601 format
1152 %%%%%%%%%%%%%%%%%%%%%%%%%%% calendar calculations %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1154 \membersection{wxDateTime::SetToWeekDayInSameWeek
}\label{wxdatetimesettoweekdayinsameweek
}
1156 \func{wxDateTime\&
}{SetToWeekDayInSameWeek
}{\param{WeekDay
}{weekday
},
\param{WeekFlags
}{flags =
{\tt Monday
\_First}}}
1158 Adjusts the date so that it will still lie in the same week as before, but its
1159 week day will be the given one.
1161 Returns the reference to the modified object itself.
1163 \membersection{wxDateTime::GetWeekDayInSameWeek
}\label{wxdatetimegetweekdayinsameweek
}
1165 \constfunc{wxDateTime
}{GetWeekDayInSameWeek
}{\param{WeekDay
}{weekday
},
\param{WeekFlags
}{flags =
{\tt Monday
\_First}}}
1167 Returns the copy of this object to which
1168 \helpref{SetToWeekDayInSameWeek
}{wxdatetimesettoweekdayinsameweek
} was
1171 \membersection{wxDateTime::SetToNextWeekDay
}\label{wxdatetimesettonextweekday
}
1173 \func{wxDateTime\&
}{SetToNextWeekDay
}{\param{WeekDay
}{weekday
}}
1175 Sets the date so that it will be the first
{\it weekday
} following the current
1178 Returns the reference to the modified object itself.
1180 \membersection{wxDateTime::GetNextWeekDay
}\label{wxdatetimegetnextweekday
}
1182 \constfunc{wxDateTime
}{GetNextWeekDay
}{\param{WeekDay
}{weekday
}}
1184 Returns the copy of this object to which
1185 \helpref{SetToNextWeekDay
}{wxdatetimesettonextweekday
} was applied.
1187 \membersection{wxDateTime::SetToPrevWeekDay
}\label{wxdatetimesettoprevweekday
}
1189 \func{wxDateTime\&
}{SetToPrevWeekDay
}{\param{WeekDay
}{weekday
}}
1191 Sets the date so that it will be the last
{\it weekday
} before the current
1194 Returns the reference to the modified object itself.
1196 \membersection{wxDateTime::GetPrevWeekDay
}\label{wxdatetimegetprevweekday
}
1198 \constfunc{wxDateTime
}{GetPrevWeekDay
}{\param{WeekDay
}{weekday
}}
1200 Returns the copy of this object to which
1201 \helpref{SetToPrevWeekDay
}{wxdatetimesettoprevweekday
} was applied.
1203 \membersection{wxDateTime::SetToWeekDay
}\label{wxdatetimesettoweekday
}
1205 \func{bool
}{SetToWeekDay
}{\param{WeekDay
}{weekday
},
\param{int
}{n =
1},
\param{Month
}{month = Inv
\_Month},
\param{int
}{year = Inv
\_Year}}
1207 Sets the date to the
{\it n
}-th
{\it weekday
} in the given month of the given
1208 year (the current month and year are used by default). The parameter
{\it n
}
1209 may be either positive (counting from the beginning of the month) or negative
1210 (counting from the end of it).
1212 For example,
{\tt SetToWeekDay(
2, wxDateTime::Wed)
} will set the date to the
1213 second Wednesday in the current month and
1214 {\tt SetToWeekDay(-
1, wxDateTime::Sun)
} -- to the last Sunday in it.
1216 Returns
{\tt true
} if the date was modified successfully,
{\tt false
}
1217 otherwise meaning that the specified date doesn't exist.
1219 \membersection{wxDateTime::GetWeekDay
}\label{wxdatetimegetweekday2
}
1221 \constfunc{wxDateTime
}{GetWeekDay
}{\param{WeekDay
}{weekday
},
\param{int
}{n =
1},
\param{Month
}{month = Inv
\_Month},
\param{int
}{year = Inv
\_Year}}
1223 Returns the copy of this object to which
1224 \helpref{SetToWeekDay
}{wxdatetimesettoweekday
} was applied.
1226 \membersection{wxDateTime::SetToLastWeekDay
}\label{wxdatetimesettolastweekday
}
1228 \func{bool
}{SetToLastWeekDay
}{\param{WeekDay
}{weekday
},
\param{Month
}{month = Inv
\_Month},
\param{int
}{year = Inv
\_Year}}
1230 The effect of calling this function is the same as of calling
1231 {\tt SetToWeekDay(-
1, weekday, month, year)
}. The date will be set to the last
1232 {\it weekday
} in the given month and year (the current ones by default).
1234 Always returns
{\tt true
}.
1236 \membersection{wxDateTime::GetLastWeekDay
}\label{wxdatetimegetlastweekday
}
1238 \func{wxDateTime
}{GetLastWeekDay
}{\param{WeekDay
}{weekday
},
\param{Month
}{month = Inv
\_Month},
\param{int
}{year = Inv
\_Year}}
1240 Returns the copy of this object to which
1241 \helpref{SetToLastWeekDay
}{wxdatetimesettolastweekday
} was applied.
1243 \membersection{wxDateTime::SetToTheWeek
}\label{wxdatetimesettotheweek
}
1245 \func{bool
}{SetToTheWeek
}{\param{wxDateTime
\_t }{numWeek
},
\param{WeekDay
}{weekday = Mon
},
\param{WeekFlags
}{flags =
{\tt Monday
\_First}}}
1247 Set the date to the given
{\it weekday
} in the week with given number
1248 {\it numWeek
}. The number should be in range $
1\ldots53$ and
{\tt false
} will
1249 be returned if the specified date doesn't exist.
{\tt true
} is returned if the
1250 date was changed successfully.
1252 \membersection{wxDateTime::GetWeek
}\label{wxdatetimegetweek
}
1254 \constfunc{wxDateTime
}{GetWeek
}{\param{wxDateTime
\_t }{numWeek
},
\param{WeekDay
}{weekday = Mon
},
\param{WeekFlags
}{flags =
{\tt Monday
\_First}}}
1256 Returns the copy of this object to which
1257 \helpref{SetToTheWeek
}{wxdatetimesettotheweek
} was applied.
1259 \membersection{wxDateTime::SetToLastMonthDay
}\label{wxdatetimesettolastmonthday
}
1261 \func{wxDateTime\&
}{SetToLastMonthDay
}{\param{Month
}{month = Inv
\_Month},
\param{int
}{year = Inv
\_Year}}
1263 Sets the date to the last day in the specified month (the current one by
1266 Returns the reference to the modified object itself.
1268 \membersection{wxDateTime::GetLastMonthDay
}\label{wxdatetimegetlastmonthday
}
1270 \constfunc{wxDateTime
}{GetLastMonthDay
}{\param{Month
}{month = Inv
\_Month},
\param{int
}{year = Inv
\_Year}}
1272 Returns the copy of this object to which
1273 \helpref{SetToLastMonthDay
}{wxdatetimesettolastmonthday
} was applied.
1275 \membersection{wxDateTime::SetToYearDay
}\label{wxdatetimesettoyearday
}
1277 \func{wxDateTime\&
}{SetToYearDay
}{\param{wxDateTime
\_t }{yday
}}
1279 Sets the date to the day number
{\it yday
} in the same year (i.e., unlike the
1280 other functions, this one does not use the current year). The day number
1281 should be in the range $
1\ldots366$ for the leap years and $
1\ldots365$ for
1284 Returns the reference to the modified object itself.
1286 \membersection{wxDateTime::GetYearDay
}\label{wxdatetimegetyearday
}
1288 \constfunc{wxDateTime
}{GetYearDay
}{\param{wxDateTime
\_t }{yday
}}
1290 Returns the copy of this object to which
1291 \helpref{SetToYearDay
}{wxdatetimesettoyearday
} was applied.
1293 %%%%%%%%%%%%%%%%%%%%%%%%%%% astronomical functions %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1295 \membersection{wxDateTime::GetJulianDayNumber
}\label{wxdatetimegetjuliandaynumber
}
1297 \constfunc{double
}{GetJulianDayNumber
}{\void}
1299 Returns the
\helpref{JDN
}{wxdatetimesetjdn
} corresponding to this date. Beware
1302 \wxheading{See also
}
1304 \helpref{GetModifiedJulianDayNumber
}{wxdatetimegetmodifiedjuliandaynumber
}
1306 \membersection{wxDateTime::GetJDN
}\label{wxdatetimegetjdn
}
1308 \constfunc{double
}{GetJDN
}{\void}
1310 Synonym for
\helpref{GetJulianDayNumber
}{wxdatetimegetjuliandaynumber
}.
1312 \membersection{wxDateTime::GetModifiedJulianDayNumber
}\label{wxdatetimegetmodifiedjuliandaynumber
}
1314 \constfunc{double
}{GetModifiedJulianDayNumber
}{\void}
1316 Returns the
{\it Modified Julian Day Number
} (MJD) which is, by definition,
1317 equal to $JDN -
2400000.5$. The MJDs are simpler to work with as the integral
1318 MJDs correspond to midnights of the dates in the Gregorian calendar and not th
1319 noons like JDN. The MJD $
0$ is Nov
17,
1858.
1321 \membersection{wxDateTime::GetMJD
}\label{wxdatetimegetmjd
}
1323 \constfunc{double
}{GetMJD
}{\void}
1325 Synonym for
\helpref{GetModifiedJulianDayNumber
}{wxdatetimegetmodifiedjuliandaynumber
}.
1327 \membersection{wxDateTime::GetRataDie
}\label{wxdatetimegetratadie
}
1329 \constfunc{double
}{GetRataDie
}{\void}
1331 Return the
{\it Rata Die number
} of this date.
1333 By definition, the Rata Die number is a date specified as the number of days
1334 relative to a base date of December
31 of the year
0. Thus January
1 of the
1335 year
1 is Rata Die day
1.
1337 %%%%%%%%%%%%%%%%%%%%%%%%%%% timezone and DST %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1339 \membersection{wxDateTime::ToTimezone
}\label{wxdatetimetotimezone
}
1341 \constfunc{wxDateTime
}{ToTimezone
}{\param{const TimeZone\&
}{tz
},
\param{bool
}{noDST = false
}}
1343 Transform the date to the given time zone. If
{\it noDST
} is
{\tt true
}, no
1344 DST adjustments will be made.
1346 Returns the date in the new time zone.
1348 \membersection{wxDateTime::MakeTimezone
}\label{wxdatetimemaketimezone
}
1350 \func{wxDateTime\&
}{MakeTimezone
}{\param{const TimeZone\&
}{tz
},
\param{bool
}{noDST = false
}}
1352 Modifies the object in place to represent the date in another time zone. If
1353 {\it noDST
} is
{\tt true
}, no DST adjustments will be made.
1355 \membersection{wxDateTime::ToGMT
}\label{wxdatetimetogmt
}
1357 \constfunc{wxDateTime
}{ToGMT
}{\param{bool
}{noDST = false
}}
1359 This is the same as calling
\helpref{ToTimezone
}{wxdatetimetotimezone
} with
1360 the argument
{\tt GMT0
}.
1362 \membersection{wxDateTime::MakeGMT
}\label{wxdatetimemakegmt
}
1364 \func{wxDateTime\&
}{MakeGMT
}{\param{bool
}{noDST = false
}}
1366 This is the same as calling
\helpref{MakeTimezone
}{wxdatetimemaketimezone
} with
1367 the argument
{\tt GMT0
}.
1369 \membersection{wxDateTime::IsDST
}\label{wxdatetimeisdst
}
1371 \constfunc{int
}{IsDST
}{\param{Country
}{country = Country
\_Default}}
1373 Returns
{\tt true
} if the DST is applied for this date in the given country.
1375 \wxheading{See also
}
1377 \helpref{GetBeginDST
}{wxdatetimegetbegindst
} and
1378 \helpref{GetEndDST
}{wxdatetimegetenddst
}
1380 \section{\class{wxDateTimeHolidayAuthority
}}\label{wxdatetimeholidayauthority
}
1384 \section{\class{wxDateTimeWorkDays
}}\label{wxdatetimeworkdays
}