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{ResetTime
}{wxdatetimeresettime
}\\
239 \helpref{SetYear
}{wxdatetimesetyear
}\\
240 \helpref{SetMonth
}{wxdatetimesetmonth
}\\
241 \helpref{SetDay
}{wxdatetimesetdate
}\\
242 \helpref{SetHour
}{wxdatetimesethour
}\\
243 \helpref{SetMinute
}{wxdatetimesetminute
}\\
244 \helpref{SetSecond
}{wxdatetimesetsecond
}\\
245 \helpref{SetMillisecond
}{wxdatetimesetmillisecond
}\\
246 \helpref{operator$=$(time
\_t)
}{wxdatetimeoperatoreqtimet
}\\
247 \helpref{operator$=$(struct tm)
}{wxdatetimeoperatoreqtm
}
248 %\helpref{operator$=$(struct Tm)}{wxdatetimeoperatortm2}
250 \membersection{Accessors
}
252 Here are the trivial accessors. Other functions, which might have to perform
253 some more complicated calculations to find the answer are under the
254 \helpref{Calendar calculations
}{wxdatetimecalculations
} section.
256 \helpref{IsValid
}{wxdatetimeisvalid
}\\
257 \helpref{GetTicks
}{wxdatetimegetticks
}\\
258 \helpref{GetYear
}{wxdatetimegetyear
}\\
259 \helpref{GetMonth
}{wxdatetimegetmonth
}\\
260 \helpref{GetDay
}{wxdatetimegetday
}\\
261 \helpref{GetWeekDay
}{wxdatetimegetweekday
}\\
262 \helpref{GetHour
}{wxdatetimegethour
}\\
263 \helpref{GetMinute
}{wxdatetimegetminute
}\\
264 \helpref{GetSecond
}{wxdatetimegetsecond
}\\
265 \helpref{GetMillisecond
}{wxdatetimegetmillisecond
}\\
266 \helpref{GetDayOfYear
}{wxdatetimegetdayofyear
}\\
267 \helpref{GetWeekOfYear
}{wxdatetimegetweekofyear
}\\
268 \helpref{GetWeekOfMonth
}{wxdatetimegetweekofmonth
}\\
269 \helpref{GetYearDay
}{wxdatetimegetyearday
}\\
270 \helpref{IsWorkDay
}{wxdatetimeisworkday
}\\
271 \helpref{IsGregorianDate
}{wxdatetimeisgregoriandate
}
273 \membersection{Date comparison
}
275 There are several function to allow date comparison. To supplement them, a few
276 global operators $>$, $<$ etc taking wxDateTime are defined.
278 \helpref{IsEqualTo
}{wxdatetimeisequalto
}\\
279 \helpref{IsEarlierThan
}{wxdatetimeisearlierthan
}\\
280 \helpref{IsLaterThan
}{wxdatetimeislaterthan
}\\
281 \helpref{IsStrictlyBetween
}{wxdatetimeisstrictlybetween
}\\
282 \helpref{IsBetween
}{wxdatetimeisbetween
}\\
283 \helpref{IsSameDate
}{wxdatetimeissamedate
}\\
284 \helpref{IsSameTime
}{wxdatetimeissametime
}\\
285 \helpref{IsEqualUpTo
}{wxdatetimeisequalupto
}
287 \membersection{Date arithmetics
}
289 These functions carry out
\helpref{arithmetics
}{tdatearithm
} on the wxDateTime
290 objects. As explained in the overview, either wxTimeSpan or wxDateSpan may be
291 added to wxDateTime, hence all functions are overloaded to accept both
294 Also, both
{\tt Add()
} and
{\tt Subtract()
} have both const and non-const
295 version. The first one returns a new obejct which represents the
296 sum/difference of the original one with the argument while the second form
297 modifies the object to which it is applied. The operators $-=$ and $+=$ are
298 defined to be equivalent to the second forms of these functions.
300 \helpref{Add(wxTimeSpan)
}{wxdatetimeaddts
}\\
301 \helpref{Add(wxDateSpan)
}{wxdatetimeaddds
}\\
302 \helpref{Subtract(wxTimeSpan)
}{wxdatetimesubtractts
}\\
303 \helpref{Subtract(wxDateSpan)
}{wxdatetimesubtractds
}\\
304 \helpref{Subtract(wxDateTime)
}{wxdatetimesubtractdt
}\\
305 \helpref{oparator$+=$(wxTimeSpan)
}{wxdatetimeaddts
}\\
306 \helpref{oparator$+=$(wxDateSpan)
}{wxdatetimeaddds
}\\
307 \helpref{oparator$-=$(wxTimeSpan)
}{wxdatetimesubtractts
}\\
308 \helpref{oparator$-=$(wxDateSpan)
}{wxdatetimesubtractds
}
310 \membersection{Parsing and formatting dates
}
312 These functions convert wxDateTime obejcts to and from text. The
313 conversions to text are mostly trivial: you can either do it using the default
314 date and time representations for the current locale (
315 \helpref{FormatDate
}{wxdatetimeformatdate
} and
316 \helpref{FormatTime
}{wxdatetimeformattime
}), using the international standard
317 representation defined by ISO
8601 (
318 \helpref{FormatISODate
}{wxdatetimeformatisodate
} and
319 \helpref{FormatISOTime
}{wxdatetimeformatisotime
}) or by specifying any format
320 at all and using
\helpref{Format
}{wxdatetimeformat
} directly.
322 The conversions from text are more interesting, as there are much more
323 possibilities to care about. The simplest cases can be taken care of with
324 \helpref{ParseFormat
}{wxdatetimeparseformat
} which can parse any date in the
325 given (rigid) format.
\helpref{ParseRfc822Date
}{wxdatetimeparserfc822date
} is
326 another function for parsing dates in predefined format -- the one of RFC
822
327 which (still...) defines the format of email messages on the Internet. This
328 format can not be described with
{\tt strptime(
3)
}-like format strings used by
329 \helpref{Format
}{wxdatetimeformat
}, hence the need for a separate function.
331 But the most interesting functions are
332 \helpref{ParseTime
}{wxdatetimeparsetime
},
333 \helpref{ParseDate
}{wxdatetimeparsedate
} and
334 \helpref{ParseDateTime
}{wxdatetimeparsedatetime
}. They try to parse the date
335 ans time (or only one of them) in `free' format, i.e. allow them to be
336 specified in any of possible ways. These functions will usually be used to
337 parse the (interactive) user input which is not bound to be in any predefined
338 format. As an example,
\helpref{ParseDateTime
}{wxdatetimeparsedatetime
} can
339 parse the strings such as
{\tt "tomorrow"
},
{\tt "March first"
} and even
342 \helpref{ParseRfc822Date
}{wxdatetimeparserfc822date
}\\
343 \helpref{ParseFormat
}{wxdatetimeparseformat
}\\
344 \helpref{ParseDateTime
}{wxdatetimeparsedatetime
}\\
345 \helpref{ParseDate
}{wxdatetimeparsedate
}\\
346 \helpref{ParseTime
}{wxdatetimeparsetime
}\\
347 \helpref{Format
}{wxdatetimeformat
}\\
348 \helpref{FormatDate
}{wxdatetimeformatdate
}\\
349 \helpref{FormatTime
}{wxdatetimeformattime
}\\
350 \helpref{FormatISODate
}{wxdatetimeformatisodate
}\\
351 \helpref{FormatISOTime
}{wxdatetimeformatisotime
}
353 \membersection{Calendar calculations
}\label{wxdatetimecalculations
}
355 The functions in this section perform the basic calendar calculations, mostly
356 related to the week days. They allow to find the given week day in the
357 week with given number (either in the month or in the year) and so on.
359 All (non-const) functions in this section don't modify the time part of the
360 wxDateTime -- they only work with the date part of it.
362 \helpref{SetToWeekDayInSameWeek
}{wxdatetimesettoweekdayinsameweek
}\\
363 \helpref{GetWeekDayInSameWeek
}{wxdatetimegetweekdayinsameweek
}\\
364 \helpref{SetToNextWeekDay
}{wxdatetimesettonextweekday
}\\
365 \helpref{GetNextWeekDay
}{wxdatetimegetnextweekday
}\\
366 \helpref{SetToPrevWeekDay
}{wxdatetimesettoprevweekday
}\\
367 \helpref{GetPrevWeekDay
}{wxdatetimegetprevweekday
}\\
368 \helpref{SetToWeekDay
}{wxdatetimesettoweekday
}\\
369 \helpref{GetWeekDay
}{wxdatetimegetweekday2
}\\
370 \helpref{SetToLastWeekDay
}{wxdatetimesettolastweekday
}\\
371 \helpref{GetLastWeekDay
}{wxdatetimegetlastweekday
}\\
372 \helpref{SetToTheWeek
}{wxdatetimesettotheweek
}\\
373 \helpref{GetWeek
}{wxdatetimegetweek
}\\
374 \helpref{SetToLastMonthDay
}{wxdatetimesettolastmonthday
}\\
375 \helpref{GetLastMonthDay
}{wxdatetimegetlastmonthday
}\\
376 \helpref{SetToYearDay
}{wxdatetimesettoyearday
}\\
377 \helpref{GetYearDay
}{wxdatetimegetyearday
}
379 \membersection{Astronomical/historical functions
}
381 Some degree of support for the date units used in astronomy and/or history is
382 provided. You can construct a wxDateTime object from a
383 \helpref{JDN
}{wxdatetimesetjdn
} and you may also get its JDN,
384 \helpref{MJD
}{wxdatetimegetmodifiedjuliandaynumber
} or
385 \helpref{Rata Die number
}{wxdatetimegetratadie
} from it.
387 \helpref{wxDateTime(double jdn)
}{wxdatetimewxdatetimejdn
}\\
388 \helpref{Set(double jdn)
}{wxdatetimesetjdn
}\\
389 \helpref{GetJulianDayNumber
}{wxdatetimegetjuliandaynumber
}\\
390 \helpref{GetJDN
}{wxdatetimegetjdn
}\\
391 \helpref{GetModifiedJulianDayNumber
}{wxdatetimegetmodifiedjuliandaynumber
}\\
392 \helpref{GetMJD
}{wxdatetimegetmjd
}\\
393 \helpref{GetRataDie
}{wxdatetimegetratadie
}
395 \membersection{Time zone and DST support
}
397 Please see the
\helpref{time zone overview
}{tdatetimezones
} for more
398 information about time zones. ormally, these functions should be rarely used.
400 \helpref{ToTimezone
}{wxdatetimetotimezone
}\\
401 \helpref{MakeTimezone
}{wxdatetimemaketimezone
}\\
402 \helpref{ToGMT
}{wxdatetimetogmt
}\\
403 \helpref{MakeGMT
}{wxdatetimemakegmt
}\\
404 \helpref{GetBeginDST
}{wxdatetimegetbegindst
}\\
405 \helpref{GetEndDST
}{wxdatetimegetenddst
}\\
406 \helpref{IsDST
}{wxdatetimeisdst
}
408 \helponly{\insertatlevel{2}{
414 %%%%%%%%%%%%%%%%%%%%%%%%%%% static functions %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
416 \membersection{wxDateTime::ConvertYearToBC
}\label{wxdatetimeconvertyeartobc
}
418 \func{static int
}{ConvertYearToBC
}{\param{int
}{year
}}
420 Converts the year in absolute notation (i.e. a number which can be negative,
421 positive or zero) to the year in BC/AD notation. For the positive years,
422 nothing is done, but the year
0 is year
1 BC and so for other years there is a
425 This function should be used like this:
429 int y = dt.GetYear();
430 printf("The year is
%d%s", wxDateTime::ConvertYearToBC(y), y > 0 ? "AD" : "BC");
433 \membersection{wxDateTime::GetAmPmStrings
}\label{wxdatetimegetampmstrings
}
435 \func{static void
}{GetAmPmStrings
}{\param{wxString *
}{am
},
\param{wxString *
}{pm
}}
437 Returns the translations of the strings
{\tt AM
} and
{\tt PM
} used for time
438 formatting for the current locale. Either of the pointers may be
{\tt NULL
} if
439 the corresponding value is not needed.
441 \membersection{wxDateTime::GetBeginDST
}\label{wxdatetimegetbegindst
}
443 \func{static wxDateTime
}{GetBeginDST
}{\param{int
}{year = Inv
\_Year},
\param{Country
}{country = Country
\_Default}}
445 Get the beginning of DST for the given country in the given year (current one
446 by default). This function suffers from limitations described in
447 \helpref{DST overview
}{tdatedst
}.
451 \helpref{GetEndDST
}{wxdatetimegetenddst
}
453 \membersection{wxDateTime::GetCountry
}\label{wxdatetimegetcountry
}
455 \func{static Country
}{GetCountry
}{\void}
457 Returns the current default country. The default country is used for DST
458 calculations, for example.
462 \helpref{SetCountry
}{wxdatetimesetcountry
}
464 \membersection{wxDateTime::GetCurrentYear
}\label{wxdatetimegetcurrentyear
}
466 \func{static int
}{GetCurrentYear
}{\param{Calendar
}{cal = Gregorian
}}
468 Get the current year in given calendar (only Gregorian is currently supported).
470 \membersection{wxDateTime::GetCurrentMonth
}\label{wxdatetimegetcurrentmonth
}
472 \func{static Month
}{GetCurrentMonth
}{\param{Calendar
}{cal = Gregorian
}}
474 Get the current month in given calendar (only Gregorian is currently supported).
476 \membersection{wxDateTime::GetCentury
}\label{wxdatetimegetcentury
}
478 \func{static int
}{GetCentury
}{\param{int
}{year = Inv
\_Year}}
480 Get the current century, i.e. first two digits of the year, in given calendar
481 (only Gregorian is currently supported).
483 \membersection{wxDateTime::GetEndDST
}\label{wxdatetimegetenddst
}
485 \func{static wxDateTime
}{GetEndDST
}{\param{int
}{year = Inv
\_Year},
\param{Country
}{country = Country
\_Default}}
487 Returns the end of DST for the given country in the given year (current one by
492 \helpref{GetBeginDST
}{wxdatetimegetbegindst
}
494 \membersection{wxDateTime::GetMonthName
}\label{wxdatetimegetmonthname
}
496 \func{static wxString
}{GetMonthName
}{\param{Month
}{month
},
\param{NameFlags
}{flags = Name
\_Full}}
498 Gets the full (default) or abbreviated (specify
{\tt Name
\_Abbr} name of the
503 \helpref{GetWeekDayName
}{wxdatetimegetweekdayname
}
505 \membersection{wxDateTime::GetNumberOfDays
}\label{wxdatetimegetnumberofdays
}
507 \func{static wxDateTime
\_t}{GetNumberOfDays
}{\param{int
}{year
},
\param{Calendar
}{cal = Gregorian
}}
509 \func{static wxDateTime
\_t}{GetNumberOfDays
}{\param{Month
}{month
},
\param{int
}{year = Inv
\_Year},
\param{Calendar
}{cal = Gregorian
}}
511 Returns the number of days in the given year or in the given month of the
514 The only supported value for
{\it cal
} parameter is currently
{\tt Gregorian
}.
516 \pythonnote{These two methods are named
{\tt GetNumberOfDaysInYear
}
517 and
{\tt GetNumberOfDaysInMonth
} in wxPython.
}
519 \membersection{wxDateTime::GetWeekDayName
}\label{wxdatetimegetweekdayname
}
521 \func{static wxString
}{GetWeekDayName
}{\param{WeekDay
}{weekday
},
\param{NameFlags
}{flags = Name
\_Full}}
523 Gets the full (default) or abbreviated (specify
{\tt Name
\_Abbr} name of the
528 \helpref{GetMonthName
}{wxdatetimegetmonthname
}
530 \membersection{wxDateTime::IsLeapYear
}\label{wxdatetimeisleapyear
}
532 \func{static bool
}{IsLeapYear
}{\param{int
}{year = Inv
\_Year},
\param{Calendar
}{cal = Gregorian
}}
534 Returns
{\tt TRUE
} if the
{\it year
} is a leap one in the specified calendar.
536 This functions supports Gregorian and Julian calendars.
538 \membersection{wxDateTime::IsWestEuropeanCountry
}\label{wxdatetimeiswesteuropeancountry
}
540 \func{static bool
}{IsWestEuropeanCountry
}{\param{Country
}{country = Country
\_Default}}
542 This function returns
{\tt TRUE
} if the specified (or default) country is one
543 of Western European ones. It is used internally by wxDateTime to determine the
544 DST convention and date and time formatting rules.
546 \membersection{wxDateTime::IsDSTApplicable
}\label{wxdatetimeisdstapplicable
}
548 \func{static bool
}{IsDSTApplicable
}{\param{int
}{year = Inv
\_Year},
\param{Country
}{country = Country
\_Default}}
550 Returns
{\tt TRUE
} if DST was used n the given year (the current one by
551 default) in the given country.
553 \membersection{wxDateTime::Now
}\label{wxdatetimenow
}
555 \func{static wxDateTime
}{Now
}{\void}
557 Returns the object corresponding to the current time.
562 wxDateTime now = wxDateTime::Now();
563 printf("Current time in Paris:
\t%s\n", now.Format("%c", wxDateTime::CET).c_str());
566 Note that this function is accurate up to second:
567 \helpref{wxDateTime::UNow
}{wxdatetimeunow
} should be used for better precision
568 (but it is less efficient and might not be available on all platforms).
572 \helpref{Today
}{wxdatetimetoday
}
574 \membersection{wxDateTime::SetCountry
}\label{wxdatetimesetcountry
}
576 \func{static void
}{SetCountry
}{\param{Country
}{country
}}
578 Sets the country to use by default. This setting influences the DST
579 calculations, date formatting and other things.
581 The possible values for
{\it country
} parameter are enumerated in
582 \helpref{wxDateTime constants section
}{wxdatetime
}.
586 \helpref{GetCountry
}{wxdatetimegetcountry
}
588 \membersection{wxDateTime::Today
}\label{wxdatetimetoday
}
590 \func{static wxDateTime
}{Today
}{\void}
592 Returns the object corresponding to the midnight of the current day (i.e. the
593 same as
\helpref{Now()
}{wxdatetimenow
}, but the time part is set to $
0$).
597 \helpref{Now
}{wxdatetimenow
}
599 \membersection{wxDateTime::UNow
}\label{wxdatetimeunow
}
601 \func{static wxDateTime
}{UNow
}{\void}
603 Returns the object corresponding to the current time including the
604 milliseconds if a function to get time with such precision is available on the
605 current platform (supported under most Unices and Win32).
609 \helpref{Now
}{wxdatetimenow
}
611 %%%%%%%%%%%%%%%%%%%%%%%%%%% constructors &c %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
613 \membersection{wxDateTime::wxDateTime
}\label{wxdatetimewxdatetimedef
}
615 \func{}{wxDateTime
}{\void}
617 Default constructor. Use one of
{\tt Set()
} functions to initialize the object
620 \membersection{wxDateTime::wxDateTime
}\label{wxdatetimewxdatetimetimet
}
622 \func{wxDateTime\&
}{wxDateTime
}{\param{time
\_t }{timet
}}
624 Same as
\helpref{Set
}{wxdatetimewxdatetimetimet
}.
626 \pythonnote{This constructor is named
{\tt wxDateTimeFromTimeT
} in wxPython.
}
628 \membersection{wxDateTime::wxDateTime
}\label{wxdatetimewxdatetimetm
}
630 \func{wxDateTime\&
}{wxDateTime
}{\param{const struct tm\&
}{tm
}}
632 Same as
\helpref{Set
}{wxdatetimewxdatetimetm
}
634 \pythonnote{Unsupported.
}
636 \membersection{wxDateTime::wxDateTime
}\label{wxdatetimewxdatetimejdn
}
638 \func{wxDateTime\&
}{wxDateTime
}{\param{double
}{jdn
}}
640 Same as
\helpref{Set
}{wxdatetimewxdatetimejdn
}
642 \pythonnote{This constructor is named
{\tt wxDateTimeFromJDN
} in wxPython.
}
644 \membersection{wxDateTime::wxDateTime
}\label{wxdatetimewxdatetimetime
}
646 \func{wxDateTime\&
}{wxDateTime
}{\param{wxDateTime
\_t }{hour
},
\param{wxDateTime
\_t }{minute =
0},
\param{wxDateTime
\_t }{second =
0},
\param{wxDateTime
\_t }{millisec =
0}}
648 Same as
\helpref{Set
}{wxdatetimewxdatetimetime
}
650 \pythonnote{This constructor is named
{\tt wxDateTimeFromHMS
} in wxPython.
}
652 \membersection{wxDateTime::wxDateTime
}\label{wxdatetimewxdatetimedate
}
654 \func{wxDateTime\&
}{wxDateTime
}{\param{wxDateTime
\_t }{day
},
\param{Month
}{month = Inv
\_Month},
\param{int
}{ Inv
\_Year},
655 \param{wxDateTime
\_t }{hour =
0},
\param{wxDateTime
\_t }{minute =
0},
\param{wxDateTime
\_t }{second =
0},
\param{wxDateTime
\_t }{millisec =
0}}
657 Same as
\helpref{Set
}{wxdatetimesetdate
}
659 \pythonnote{This constructor is named
{\tt wxDateTimeFromDMY
} in wxPython.
}
661 \membersection{wxDateTime::SetToCurrent
}\label{wxdatetimesettocurrent
}
663 \func{wxDateTime\&
}{SetToCurrent
}{\void}
665 Sets the date and time of to the current values. Same as assigning the result
666 of
\helpref{Now()
}{wxdatetimenow
} to this object.
668 \membersection{wxDateTime::Set
}\label{wxdatetimesettimet
}
670 \func{wxDateTime\&
}{Set
}{\param{time
\_t }{timet
}}
672 Constructs the object from
{\it timet
} value holding the number of seconds
675 \pythonnote{This method is named
{\tt SetTimeT
} in wxPython.
}
677 \membersection{wxDateTime::Set
}\label{wxdatetimesettm
}
679 \func{wxDateTime\&
}{Set
}{\param{const struct tm\&
}{tm
}}
681 Sets the date and time from the broken down representation in the standard
684 \pythonnote{Unsupported.
}
686 \membersection{wxDateTime::Set
}\label{wxdatetimesetjdn
}
688 \func{wxDateTime\&
}{Set
}{\param{double
}{jdn
}}
690 Sets the date from the so-called
{\it Julian Day Number
}.
692 By definition, the Julian Day Number, usually abbreviated as JDN, of a
693 particular instant is the fractional number of days since
12 hours Universal
694 Coordinated Time (Greenwich mean noon) on January
1 of the year -
4712 in the
695 Julian proleptic calendar.
697 \pythonnote{This method is named
{\tt SetJDN
} in wxPython.
}
699 \membersection{wxDateTime::Set
}\label{wxdatetimesettime
}
701 \func{wxDateTime\&
}{Set
}{\param{wxDateTime
\_t }{hour
},
\param{wxDateTime
\_t }{minute =
0},
\param{wxDateTime
\_t }{second =
0},
\param{wxDateTime
\_t }{millisec =
0}}
703 Sets the date to be equal to
\helpref{Today
}{wxdatetimetoday
} and the time
704 from supplied parameters.
706 \pythonnote{This method is named
{\tt SetHMS
} in wxPython.
}
708 \membersection{wxDateTime::Set
}\label{wxdatetimesetdate
}
710 \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}}
712 Sets the date and time from the parameters.
714 \membersection{wxDateTime::ResetTime
}\label{wxdatetimeresettime
}
716 \func{wxDateTime\&
}{ResetTime
}{\void}
718 Reset time to midnight (
00:
00:
00) without changing the date.
720 \membersection{wxDateTime::SetYear
}\label{wxdatetimesetyear
}
722 \func{wxDateTime\&
}{SetYear
}{\param{int
}{year
}}
724 Sets the year without changing other date components.
726 \membersection{wxDateTime::SetMonth
}\label{wxdatetimesetmonth
}
728 \func{wxDateTime\&
}{SetMonth
}{\param{Month
}{month
}}
730 Sets the month without changing other date components.
732 \membersection{wxDateTime::SetDay
}\label{wxdatetimesetday
}
734 \func{wxDateTime\&
}{SetDay
}{\param{wxDateTime
\_t }{day
}}
736 Sets the day without changing other date components.
738 \membersection{wxDateTime::SetHour
}\label{wxdatetimesethour
}
740 \func{wxDateTime\&
}{SetHour
}{\param{wxDateTime
\_t }{hour
}}
742 Sets the hour without changing other date components.
744 \membersection{wxDateTime::SetMinute
}\label{wxdatetimesetminute
}
746 \func{wxDateTime\&
}{SetMinute
}{\param{wxDateTime
\_t }{minute
}}
748 Sets the minute without changing other date components.
750 \membersection{wxDateTime::SetSecond
}\label{wxdatetimesetsecond
}
752 \func{wxDateTime\&
}{SetSecond
}{\param{wxDateTime
\_t }{second
}}
754 Sets the second without changing other date components.
756 \membersection{wxDateTime::SetMillisecond
}\label{wxdatetimesetmillisecond
}
758 \func{wxDateTime\&
}{SetMillisecond
}{\param{wxDateTime
\_t }{millisecond
}}
760 Sets the millisecond without changing other date components.
762 \membersection{wxDateTime::operator$=$
}\label{wxdatetimeoperatoreqtimet
}
764 \func{wxDateTime\&
}{operator
}{\param{time
\_t }{timet
}}
766 Same as
\helpref{Set
}{wxdatetimesettimet
}.
768 \membersection{wxDateTime::operator$=$
}\label{wxdatetimeoperatoreqtm
}
770 \func{wxDateTime\&
}{operator
}{\param{const struct tm\&
}{tm
}}
772 Same as
\helpref{Set
}{wxdatetimesettm
}.
774 %%%%%%%%%%%%%%%%%%%%%%%%%%% accessors %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
776 \membersection{wxDateTime::IsValid
}\label{wxdatetimeisvalid
}
778 \constfunc{bool
}{IsValid
}{\void}
780 Returns
{\tt TRUE
} if the object represents a valid time moment.
782 \membersection{wxDateTime::GetTm
}\label{wxdatetimegettm
}
784 \constfunc{Tm
}{GetTm
}{\param{const TimeZone\&
}{tz = Local
}}
786 Returns broken down representation of the date and time.
788 \membersection{wxDateTime::GetTicks
}\label{wxdatetimegetticks
}
790 \constfunc{time
\_t}{GetTicks
}{\void}
792 Returns the number of seconds since Jan
1,
1970. An assert failure will occur
793 if the date is not in the range covered by
{\tt time
\_t} type.
795 \membersection{wxDateTime::GetYear
}\label{wxdatetimegetyear
}
797 \constfunc{int
}{GetYear
}{\param{const TimeZone\&
}{tz = Local
}}
799 Returns the year in the given timezone (local one by default).
801 \membersection{wxDateTime::GetMonth
}\label{wxdatetimegetmonth
}
803 \constfunc{Month
}{GetMonth
}{\param{const TimeZone\&
}{tz = Local
}}
805 Returns the month in the given timezone (local one by default).
807 \membersection{wxDateTime::GetDay
}\label{wxdatetimegetday
}
809 \constfunc{wxDateTime
\_t}{GetDay
}{\param{const TimeZone\&
}{tz = Local
}}
811 Returns the day in the given timezone (local one by default).
813 \membersection{wxDateTime::GetWeekDay
}\label{wxdatetimegetweekday
}
815 \constfunc{WeekDay
}{GetWeekDay
}{\param{const TimeZone\&
}{tz = Local
}}
817 Returns the week day in the given timezone (local one by default).
819 \membersection{wxDateTime::GetHour
}\label{wxdatetimegethour
}
821 \constfunc{wxDateTime
\_t}{GetHour
}{\param{const TimeZone\&
}{tz = Local
}}
823 Returns the hour in the given timezone (local one by default).
825 \membersection{wxDateTime::GetMinute
}\label{wxdatetimegetminute
}
827 \constfunc{wxDateTime
\_t}{GetMinute
}{\param{const TimeZone\&
}{tz = Local
}}
829 Returns the minute in the given timezone (local one by default).
831 \membersection{wxDateTime::GetSecond
}\label{wxdatetimegetsecond
}
833 \constfunc{wxDateTime
\_t}{GetSecond
}{\param{const TimeZone\&
}{tz = Local
}}
835 Returns the seconds in the given timezone (local one by default).
837 \membersection{wxDateTime::GetMillisecond
}\label{wxdatetimegetmillisecond
}
839 \constfunc{wxDateTime
\_t}{GetMillisecond
}{\param{const TimeZone\&
}{tz = Local
}}
841 Returns the milliseconds in the given timezone (local one by default).
843 \membersection{wxDateTime::GetDayOfYear
}\label{wxdatetimegetdayofyear
}
845 \constfunc{wxDateTime
\_t}{GetDayOfYear
}{\param{const TimeZone\&
}{tz = Local
}}
847 Returns the day of the year (in $
1\ldots366$ range) in the given timezone
848 (local one by default).
850 \membersection{wxDateTime::GetWeekOfYear
}\label{wxdatetimegetweekofyear
}
852 \constfunc{wxDateTime
\_t}{GetWeekOfYear
}{\param{WeekFlags
}{flags = Monday
\_First},
\param{const TimeZone\&
}{tz = Local
}}
854 Returns the number of the week of the year this date is in. The first week of
855 the year is, according to international standards, the one containing Jan
4.
856 The week number is in $
1\ldots53$ range ($
52$ for non leap years).
858 The function depends on the
\helpref{week start
}{wxdatetime
} convention
859 specified by the
{\it flags
} argument.
861 \membersection{wxDateTime::GetWeekOfMonth
}\label{wxdatetimegetweekofmonth
}
863 \constfunc{wxDateTime
\_t}{GetWeekOfMonth
}{\param{WeekFlags
}{flags = Monday
\_First},
\param{const TimeZone\&
}{tz = Local
}}
865 Returns the ordinal number of the week in the month (in $
1\ldots5$ range).
867 As
\helpref{GetWeekOfYear
}{wxdatetimegetweekofyear
}, this function supports
868 both conventions for the week start. See the description of these
869 \helpref{week start
}{wxdatetime
} conventions.
871 \membersection{wxDateTime::IsWorkDay
}\label{wxdatetimeisworkday
}
873 \constfunc{bool
}{IsWorkDay
}{\param{Country
}{country = Country
\_Default}}
875 Returns
{\tt TRUE
} is this day is not a holiday in the given country.
877 \membersection{wxDateTime::IsGregorianDate
}\label{wxdatetimeisgregoriandate
}
879 \constfunc{bool
}{IsGregorianDate
}{\param{GregorianAdoption
}{country = Gr
\_Standard}}
881 Returns
{\tt TRUE
} if the given date os later than the date of adoption of the
882 Gregorian calendar in the given country (and hence the Gregorian calendar
883 calculations make sense for it).
885 %%%%%%%%%%%%%%%%%%%%%%%%%%% comparison %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
887 \membersection{wxDateTime::IsEqualTo
}\label{wxdatetimeisequalto
}
889 \constfunc{bool
}{IsEqualTo
}{\param{const wxDateTime\&
}{datetime
}}
891 Returns
{\tt TRUE
} if the two dates are strictly identical.
893 \membersection{wxDateTime::IsEarlierThan
}\label{wxdatetimeisearlierthan
}
895 \constfunc{bool
}{IsEarlierThan
}{\param{const wxDateTime\&
}{datetime
}}
897 Returns
{\tt TRUE
} if this date precedes the given one.
899 \membersection{wxDateTime::IsLaterThan
}\label{wxdatetimeislaterthan
}
901 \constfunc{bool
}{IsLaterThan
}{\param{const wxDateTime\&
}{datetime
}}
903 Returns
{\tt TRUE
} if this date is later than the given one.
905 \membersection{wxDateTime::IsStrictlyBetween
}\label{wxdatetimeisstrictlybetween
}
907 \constfunc{bool
}{IsStrictlyBetween
}{\param{const wxDateTime\&
}{t1
},
\param{const wxDateTime\&
}{t2
}}
909 Returns
{\tt TRUE
} if this date lies strictly between the two others,
913 \helpref{IsBetween
}{wxdatetimeisbetween
}
915 \membersection{wxDateTime::IsBetween
}\label{wxdatetimeisbetween
}
917 \constfunc{bool
}{IsBetween
}{\param{const wxDateTime\&
}{t1
},
\param{const wxDateTime\&
}{t2
}}
919 Returns
{\tt TRUE
} if
\helpref{IsStrictlyBetween
}{wxdatetimeisstrictlybetween
}
920 is
{\tt TRUE
} or if the date is equal to one of the limit values.
924 \helpref{IsStrictlyBetween
}{wxdatetimeisstrictlybetween
}
926 \membersection{wxDateTime::IsSameDate
}\label{wxdatetimeissamedate
}
928 \constfunc{bool
}{IsSameDate
}{\param{const wxDateTime\&
}{dt
}}
930 Returns
{\tt TRUE
} if the date is the same without comparing the time parts.
932 \membersection{wxDateTime::IsSameTime
}\label{wxdatetimeissametime
}
934 \constfunc{bool
}{IsSameTime
}{\param{const wxDateTime\&
}{dt
}}
936 Returns
{\tt TRUE
} if the time is the same (although dates may differ).
938 \membersection{wxDateTime::IsEqualUpTo
}\label{wxdatetimeisequalupto
}
940 \constfunc{bool
}{IsEqualUpTo
}{\param{const wxDateTime\&
}{dt
},
\param{const wxTimeSpan\&
}{ts
}}
942 Returns
{\tt TRUE
} if the date is equal to another one up to the given time
943 interval, i.e. if the absolute difference between the two dates is less than
946 %%%%%%%%%%%%%%%%%%%%%%%%%%% arithmetics %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
948 \membersection{wxDateTime::Add
}\label{wxdatetimeaddts
}
950 \constfunc{wxDateTime
}{Add
}{\param{const wxTimeSpan\&
}{diff
}}
952 \func{wxDateTime\&
}{Add
}{\param{const wxTimeSpan\&
}{diff
}}
954 \func{wxDateTime\&
}{operator$+=$
}{\param{const wxTimeSpan\&
}{diff
}}
956 Adds the given time span to this object.
958 \pythonnote{This method is named
{\tt AddTS
} in wxPython.
}
960 \membersection{wxDateTime::Subtract
}\label{wxdatetimesubtractts
}
962 \constfunc{wxDateTime
}{Subtract
}{\param{const wxTimeSpan\&
}{diff
}}
964 \func{wxDateTime\&
}{Subtract
}{\param{const wxTimeSpan\&
}{diff
}}
966 \func{wxDateTime\&
}{operator$-=$
}{\param{const wxTimeSpan\&
}{diff
}}
968 Subtracts the given time span from this object.
970 \pythonnote{This method is named
{\tt SubtractTS
} in wxPython.
}
972 \membersection{wxDateTime::Add
}\label{wxdatetimeaddds
}
974 \constfunc{wxDateTime
}{Add
}{\param{const wxDateSpan\&
}{diff
}}
976 \func{wxDateTime\&
}{Add
}{\param{const wxDateSpan\&
}{diff
}}
978 \func{wxDateTime\&
}{operator$+=$
}{\param{const wxDateSpan\&
}{diff
}}
980 Adds the given date span to this object.
982 \pythonnote{This method is named
{\tt AddDS
} in wxPython.
}
984 \membersection{wxDateTime::Subtract
}\label{wxdatetimesubtractds
}
986 \constfunc{wxDateTime
}{Subtract
}{\param{const wxDateSpan\&
}{diff
}}
988 \func{wxDateTime\&
}{Subtract
}{\param{const wxDateSpan\&
}{diff
}}
990 \func{wxDateTime\&
}{operator$-=$
}{\param{const wxDateSpan\&
}{diff
}}
992 Subtracts the given date span from this object.
994 \pythonnote{This method is named
{\tt SubtractDS
} in wxPython.
}
996 \membersection{wxDateTime::Subtract
}\label{wxdatetimesubtractdt
}
998 \constfunc{wxTimeSpan
}{Subtract
}{\param{const wxDateTime\&
}{dt
}}
1000 Subtracts another date from this one and returns the difference between them
1003 %%%%%%%%%%%%%%%%%%%%%%%%%%% parsing/formatting %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1005 \membersection{wxDateTime::ParseRfc822Date
}\label{wxdatetimeparserfc822date
}
1007 \func{const wxChar *
}{ParseRfc822Date
}{\param{const wxChar*
}{date
}}
1009 Parses the string
{\it date
} looking for a date formatted according to the RFC
1010 822 in it. The exact description of this format may, of course, be found in
1011 the RFC (section $
5$), but, briefly, this is the format used in the headers of
1012 Internet email messages and one of the most common strings expressing date in
1013 this format may be something like
{\tt "Sat,
18 Dec
1999 00:
48:
30 +
0100"
}.
1015 Returns
{\tt NULL
} if the conversion failed, otherwise return the pointer to
1016 the character immediately following the part of the string which could be
1017 parsed. If the entire string contains only the date in RFC
822 format,
1018 the returned pointer will be pointing to a
{\tt NUL
} character.
1020 This function is intentionally strict, it will return an error for any string
1021 which is not RFC
822 compliant. If you need to parse date formatted in more
1022 free ways, you should use
\helpref{ParseDateTime
}{wxdatetimeparsedatetime
} or
1023 \helpref{ParseDate
}{wxdatetimeparsedate
} instead.
1025 \membersection{wxDateTime::ParseFormat
}\label{wxdatetimeparseformat
}
1027 \func{const wxChar *
}{ParseFormat
}{\param{const wxChar *
}{date
},
\param{const wxChar *
}{format = "\%c"
},
\param{const wxDateTime\&
}{dateDef = wxDefaultDateTime
}}
1029 This function parses the string
{\it date
} according to the given
1030 {\it format
}. The system
{\tt strptime(
3)
} function is used whenever available,
1031 but even if it is not, this function is still implemented (although support
1032 for locale-dependent format specificators such as
{\tt "\%c"
},
{\tt "\%x"
} or
1033 {\tt "\%X"
} may be not perfect). This function does handle the month and
1034 weekday names in the current locale on all platforms, however.
1036 Please the description of ANSI C function
{\tt strftime(
3)
} for the syntax of
1039 The
{\it dateDef
} parameter is used to fill in the fields which could not be
1040 determined from the format string. For example, if the format is
{\tt "\%d"
}
1041 (the day of the month), the month and the year are taken from
{\it dateDef
}.
1042 If it is not specified,
\helpref{Today
}{wxdatetimetoday
} is used as the
1045 Returns
{\tt NULL
} if the conversion failed, otherwise return the pointer to
1046 the character which stopped the scan.
1048 \membersection{wxDateTime::ParseDateTime
}\label{wxdatetimeparsedatetime
}
1050 \func{const wxChar *
}{ParseDateTime
}{\param{const wxChar *
}{datetime
}}
1052 Parses the string
{\it datetime
} containing the date and time in free format.
1053 This function tries as hard as it can to interpret the given string as date
1054 and time. Unlike
\helpref{ParseRfc822Date
}{wxdatetimeparserfc822date
}, it
1055 will accept anything that may be accepted and will only reject strings which
1056 can not be parsed in any way at all.
1058 Returns
{\tt NULL
} if the conversion failed, otherwise return the pointer to
1059 the character which stopped the scan.
1061 \membersection{wxDateTime::ParseDate
}\label{wxdatetimeparsedate
}
1063 \func{const wxChar *
}{ParseDate
}{\param{const wxChar *
}{date
}}
1065 This function is like
\helpref{ParseDateTime
}{wxdatetimeparsedatetime
}, but it
1066 only allows the date to be specified. It is thus less flexible then
1067 \helpref{ParseDateTime
}{wxdatetimeparsedatetime
}, but also has less chances to
1068 misinterpret the user input.
1070 Returns
{\tt NULL
} if the conversion failed, otherwise return the pointer to
1071 the character which stopped the scan.
1073 \membersection{wxDateTime::ParseTime
}\label{wxdatetimeparsetime
}
1075 \func{const wxChar *
}{ParseTime
}{\param{const wxChar *
}{time
}}
1077 This functions is like
\helpref{ParseDateTime
}{wxdatetimeparsedatetime
}, but
1078 only allows the time to be specified in the input string.
1080 Returns
{\tt NULL
} if the conversion failed, otherwise return the pointer to
1081 the character which stopped the scan.
1083 \membersection{wxDateTime::Format
}\label{wxdatetimeformat
}
1085 \constfunc{wxString
}{Format
}{\param{const wxChar *
}{format = "\%c"
},
\param{const TimeZone\&
}{tz = Local
}}
1087 This function does the same as the standard ANSI C
{\tt strftime(
3)
} function.
1088 Please see its description for the meaning of
{\it format
} parameter.
1090 It also accepts a few wxWindows-specific extensions: you can optionally specify
1091 the width of the field to follow using
{\tt printf(
3)
}-like syntax and the
1092 format specification
{\tt \%l
} can be used to get the number of milliseconds.
1094 \wxheading{See also
}
1096 \helpref{ParseFormat
}{wxdatetimeparseformat
}
1098 \membersection{wxDateTime::FormatDate
}\label{wxdatetimeformatdate
}
1100 \constfunc{wxString
}{FormatDate
}{\void}
1102 Identical to calling
\helpref{Format()
}{wxdatetimeformat
} with
{\tt "\%x"
}
1103 argument (which means `preferred date representation for the current locale').
1105 \membersection{wxDateTime::FormatTime
}\label{wxdatetimeformattime
}
1107 \constfunc{wxString
}{FormatTime
}{\void}
1109 Identical to calling
\helpref{Format()
}{wxdatetimeformat
} with
{\tt "\%X"
}
1110 argument (which means `preferred time representation for the current locale').
1112 \membersection{wxDateTime::FormatISODate
}\label{wxdatetimeformatisodate
}
1114 \constfunc{wxString
}{FormatISODate
}{\void}
1116 This function returns the date representation in the ISO
8601 format
1119 \membersection{wxDateTime::FormatISOTime
}\label{wxdatetimeformatisotime
}
1121 \constfunc{wxString
}{FormatISOTime
}{\void}
1123 This function returns the time representation in the ISO
8601 format
1126 %%%%%%%%%%%%%%%%%%%%%%%%%%% calendar calculations %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1128 \membersection{wxDateTime::SetToWeekDayInSameWeek
}\label{wxdatetimesettoweekdayinsameweek
}
1130 \func{wxDateTime\&
}{SetToWeekDayInSameWeek
}{\param{WeekDay
}{weekday
}}
1132 Adjusts the date so that it will still lie in the same week as before, but its
1133 week day will be the given one.
1135 Returns the reference to the modified object itself.
1137 \membersection{wxDateTime::GetWeekDayInSameWeek
}\label{wxdatetimegetweekdayinsameweek
}
1139 \constfunc{wxDateTime
}{GetWeekDayInSameWeek
}{\param{WeekDay
}{weekday
}}
1141 Returns the copy of this object to which
1142 \helpref{SetToWeekDayInSameWeek
}{wxdatetimesettoweekdayinsameweek
} was
1145 \membersection{wxDateTime::SetToNextWeekDay
}\label{wxdatetimesettonextweekday
}
1147 \func{wxDateTime\&
}{SetToNextWeekDay
}{\param{WeekDay
}{weekday
}}
1149 Sets the date so that it will be the first
{\it weekday
} following the current
1152 Returns the reference to the modified object itself.
1154 \membersection{wxDateTime::GetNextWeekDay
}\label{wxdatetimegetnextweekday
}
1156 \constfunc{wxDateTime
}{GetNextWeekDay
}{\param{WeekDay
}{weekday
}}
1158 Returns the copy of this object to which
1159 \helpref{SetToNextWeekDay
}{wxdatetimesettonextweekday
} was applied.
1161 \membersection{wxDateTime::SetToPrevWeekDay
}\label{wxdatetimesettoprevweekday
}
1163 \func{wxDateTime\&
}{SetToPrevWeekDay
}{\param{WeekDay
}{weekday
}}
1165 Sets the date so that it will be the last
{\it weekday
} before the current
1168 Returns the reference to the modified object itself.
1170 \membersection{wxDateTime::GetPrevWeekDay
}\label{wxdatetimegetprevweekday
}
1172 \constfunc{wxDateTime
}{GetPrevWeekDay
}{\param{WeekDay
}{weekday
}}
1174 Returns the copy of this object to which
1175 \helpref{SetToPrevWeekDay
}{wxdatetimesettoprevweekday
} was applied.
1177 \membersection{wxDateTime::SetToWeekDay
}\label{wxdatetimesettoweekday
}
1179 \func{bool
}{SetToWeekDay
}{\param{WeekDay
}{weekday
},
\param{int
}{n =
1},
\param{Month
}{month = Inv
\_Month},
\param{int
}{year = Inv
\_Year}}
1181 Sets the date to the
{\it n
}-th
{\it weekday
} in the given month of the given
1182 year (the current month and year are used by default). The parameter
{\it n
}
1183 may be either positive (counting from the beginning of the month) or negative
1184 (counting from the end of it).
1186 For example,
{\tt SetToWeekDay(
2, wxDateTime::Wed)
} will set the date to the
1187 second Wednesday in the current month and
1188 {\tt SetToWeekDay(-
1, wxDateTime::Sun)
} -- to the last Sunday in it.
1190 Returns
{\tt TRUE
} if the date was modified successfully,
{\tt FALSE
}
1191 otherwise meaning that the specified date doesn't exist.
1193 \membersection{wxDateTime::GetWeekDay
}\label{wxdatetimegetweekday2
}
1195 \constfunc{wxDateTime
}{GetWeekDay
}{\param{WeekDay
}{weekday
},
\param{int
}{n =
1},
\param{Month
}{month = Inv
\_Month},
\param{int
}{year = Inv
\_Year}}
1197 Returns the copy of this object to which
1198 \helpref{SetToWeekDay
}{wxdatetimesettoweekday
} was applied.
1200 \membersection{wxDateTime::SetToLastWeekDay
}\label{wxdatetimesettolastweekday
}
1202 \func{bool
}{SetToLastWeekDay
}{\param{WeekDay
}{weekday
},
\param{Month
}{month = Inv
\_Month},
\param{int
}{year = Inv
\_Year}}
1204 The effect of calling this function is the same as of calling
1205 {\tt SetToWeekDay(-
1, weekday, month, year)
}. The date will be set to the last
1206 {\it weekday
} in the given month and year (the current ones by default).
1208 Always returns
{\tt TRUE
}.
1210 \membersection{wxDateTime::GetLastWeekDay
}\label{wxdatetimegetlastweekday
}
1212 \func{wxDateTime
}{GetLastWeekDay
}{\param{WeekDay
}{weekday
},
\param{Month
}{month = Inv
\_Month},
\param{int
}{year = Inv
\_Year}}
1214 Returns the copy of this object to which
1215 \helpref{SetToLastWeekDay
}{wxdatetimesettolastweekday
} was applied.
1217 \membersection{wxDateTime::SetToTheWeek
}\label{wxdatetimesettotheweek
}
1219 \func{bool
}{SetToTheWeek
}{\param{wxDateTime
\_t }{numWeek
},
\param{WeekDay
}{weekday = Mon
}}
1221 Set the date to the given
{\it weekday
} in the week with given number
1222 {\it numWeek
}. The number should be in range $
1\ldots53$ and
{\tt FALSE
} will
1223 be returned if the specified date doesn't exist.
{\tt TRUE
} is returned if the
1224 date was changed successfully.
1226 \membersection{wxDateTime::GetWeek
}\label{wxdatetimegetweek
}
1228 \constfunc{wxDateTime
}{GetWeek
}{\param{wxDateTime
\_t }{numWeek
},
\param{WeekDay
}{weekday = Mon
}}
1230 Returns the copy of this object to which
1231 \helpref{SetToTheWeek
}{wxdatetimesettotheweek
} was applied.
1233 \membersection{wxDateTime::SetToLastMonthDay
}\label{wxdatetimesettolastmonthday
}
1235 \func{wxDateTime\&
}{SetToLastMonthDay
}{\param{Month
}{month = Inv
\_Month},
\param{int
}{year = Inv
\_Year}}
1237 Sets the date to the last day in the specified month (the current one by
1240 Returns the reference to the modified object itself.
1242 \membersection{wxDateTime::GetLastMonthDay
}\label{wxdatetimegetlastmonthday
}
1244 \constfunc{wxDateTime
}{GetLastMonthDay
}{\param{Month
}{month = Inv
\_Month},
\param{int
}{year = Inv
\_Year}}
1246 Returns the copy of this object to which
1247 \helpref{SetToLastMonthDay
}{wxdatetimesettolastmonthday
} was applied.
1249 \membersection{wxDateTime::SetToYearDay
}\label{wxdatetimesettoyearday
}
1251 \func{wxDateTime\&
}{SetToYearDay
}{\param{wxDateTime
\_t }{yday
}}
1253 Sets the date to the day number
{\it yday
} in the same year (i.e., unlike the
1254 other functions, this one does not use the current year). The day number
1255 should be in the range $
1\ldots366$ for the leap years and $
1\ldots365$ for
1258 Returns the reference to the modified object itself.
1260 \membersection{wxDateTime::GetYearDay
}\label{wxdatetimegetyearday
}
1262 \constfunc{wxDateTime
}{GetYearDay
}{\param{wxDateTime
\_t }{yday
}}
1264 Returns the copy of this object to which
1265 \helpref{SetToYearDay
}{wxdatetimesettoyearday
} was applied.
1267 %%%%%%%%%%%%%%%%%%%%%%%%%%% astronomical functions %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1269 \membersection{wxDateTime::GetJulianDayNumber
}\label{wxdatetimegetjuliandaynumber
}
1271 \constfunc{double
}{GetJulianDayNumber
}{\void}
1273 Returns the
\helpref{JDN
}{wxdatetimesetjdn
} corresponding to this date. Beware
1276 \wxheading{See also
}
1278 \helpref{GetModifiedJulianDayNumber
}{wxdatetimegetmodifiedjuliandaynumber
}
1280 \membersection{wxDateTime::GetJDN
}\label{wxdatetimegetjdn
}
1282 \constfunc{double
}{GetJDN
}{\void}
1284 Synonym for
\helpref{GetJulianDayNumber
}{wxdatetimegetjuliandaynumber
}.
1286 \membersection{wxDateTime::GetModifiedJulianDayNumber
}\label{wxdatetimegetmodifiedjuliandaynumber
}
1288 \constfunc{double
}{GetModifiedJulianDayNumber
}{\void}
1290 Returns the
{\it Modified Julian Day Number
} (MJD) which is, by definition,
1291 equal to $JDN -
2400000.5$. The MJDs are simpler to work with as the integral
1292 MJDs correspond to midnights of the dates in the Gregorian calendar and not th
1293 noons like JDN. The MJD $
0$ is Nov
17,
1858.
1295 \membersection{wxDateTime::GetMJD
}\label{wxdatetimegetmjd
}
1297 \constfunc{double
}{GetMJD
}{\void}
1299 Synonym for
\helpref{GetModifiedJulianDayNumber
}{wxdatetimegetmodifiedjuliandaynumber
}.
1301 \membersection{wxDateTime::GetRataDie
}\label{wxdatetimegetratadie
}
1303 \constfunc{double
}{GetRataDie
}{\void}
1305 Return the
{\it Rata Die number
} of this date.
1307 By definition, the Rata Die number is a date specified as the number of days
1308 relative to a base date of December
31 of the year
0. Thus January
1 of the
1309 year
1 is Rata Die day
1.
1311 %%%%%%%%%%%%%%%%%%%%%%%%%%% timezone and DST %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1313 \membersection{wxDateTime::ToTimezone
}\label{wxdatetimetotimezone
}
1315 \constfunc{wxDateTime
}{ToTimezone
}{\param{const TimeZone\&
}{tz
},
\param{bool
}{noDST = FALSE
}}
1317 Transform the date to the given time zone. If
{\it noDST
} is
{\tt TRUE
}, no
1318 DST adjustments will be made.
1320 Returns the date in the new time zone.
1322 \membersection{wxDateTime::MakeTimezone
}\label{wxdatetimemaketimezone
}
1324 \func{wxDateTime\&
}{MakeTimezone
}{\param{const TimeZone\&
}{tz
},
\param{bool
}{noDST = FALSE
}}
1326 Modifies the object in place to represent the date in another time zone. If
1327 {\it noDST
} is
{\tt TRUE
}, no DST adjustments will be made.
1329 \membersection{wxDateTime::ToGMT
}\label{wxdatetimetogmt
}
1331 \constfunc{wxDateTime
}{ToGMT
}{\param{bool
}{noDST = FALSE
}}
1333 This is the same as calling
\helpref{ToTimezone
}{wxdatetimetotimezone
} with
1334 the argument
{\tt GMT0
}.
1336 \membersection{wxDateTime::MakeGMT
}\label{wxdatetimemakegmt
}
1338 \func{wxDateTime\&
}{MakeGMT
}{\param{bool
}{noDST = FALSE
}}
1340 This is the same as calling
\helpref{MakeTimezone
}{wxdatetimemaketimezone
} with
1341 the argument
{\tt GMT0
}.
1343 \membersection{wxDateTime::IsDST
}\label{wxdatetimeisdst
}
1345 \constfunc{int
}{IsDST
}{\param{Country
}{country = Country
\_Default}}
1347 Returns
{\tt TRUE
} if the DST is applied for this date in the given country.
1349 \wxheading{See also
}
1351 \helpref{GetBeginDST
}{wxdatetimegetbegindst
} and
1352 \helpref{GetEndDST
}{wxdatetimegetenddst
}
1354 \section{\class{wxDateTimeHolidayAuthority
}}\label{wxdatetimeholidayauthority
}
1358 \section{\class{wxDateTimeWorkDays
}}\label{wxdatetimeworkdays
}