1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of wxDateTime
4 // Author: wxWidgets team
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
13 wxDateTime class represents an absolute moment in the time.
15 The type @c wxDateTime_t is typedefed as <tt>unsigned short</tt> and is
16 used to contain the number of years, hours, minutes, seconds and
20 @section datetime_constants Constants
22 Global constant wxDefaultDateTime and synonym for it wxInvalidDateTime are
23 defined. This constant will be different from any valid wxDateTime object.
25 All the following constants are defined inside wxDateTime class (i.e., to
26 refer to them you should prepend their names with "wxDateTime::").
28 Time zone symbolic names:
33 // the time in the current time zone
36 // zones from GMT (= Greenwhich Mean Time): they're guaranteed to be
37 // consequent numbers, so writing something like `GMT0 + offset' is
38 // safe if abs(offset) <= 12
40 // underscore stands for minus
41 GMT_12, GMT_11, GMT_10, GMT_9, GMT_8, GMT_7,
42 GMT_6, GMT_5, GMT_4, GMT_3, GMT_2, GMT_1,
44 GMT1, GMT2, GMT3, GMT4, GMT5, GMT6,
45 GMT7, GMT8, GMT9, GMT10, GMT11, GMT12, GMT13,
46 // Note that GMT12 and GMT_12 are not the same: there is a difference
47 // of exactly one day between them
49 // some symbolic names for TZ
52 WET = GMT0, // Western Europe Time
53 WEST = GMT1, // Western Europe Summer Time
54 CET = GMT1, // Central Europe Time
55 CEST = GMT2, // Central Europe Summer Time
56 EET = GMT2, // Eastern Europe Time
57 EEST = GMT3, // Eastern Europe Summer Time
58 MSK = GMT3, // Moscow Time
59 MSD = GMT4, // Moscow Summer Time
62 AST = GMT_4, // Atlantic Standard Time
63 ADT = GMT_3, // Atlantic Daylight Time
64 EST = GMT_5, // Eastern Standard Time
65 EDT = GMT_4, // Eastern Daylight Saving Time
66 CST = GMT_6, // Central Standard Time
67 CDT = GMT_5, // Central Daylight Saving Time
68 MST = GMT_7, // Mountain Standard Time
69 MDT = GMT_6, // Mountain Daylight Saving Time
70 PST = GMT_8, // Pacific Standard Time
71 PDT = GMT_7, // Pacific Daylight Saving Time
72 HST = GMT_10, // Hawaiian Standard Time
73 AKST = GMT_9, // Alaska Standard Time
74 AKDT = GMT_8, // Alaska Daylight Saving Time
78 A_WST = GMT8, // Western Standard Time
79 A_CST = GMT13 + 1, // Central Standard Time (+9.5)
80 A_EST = GMT10, // Eastern Standard Time
81 A_ESST = GMT11, // Eastern Summer Time
84 NZST = GMT12, // Standard Time
85 NZDT = GMT13, // Daylight Saving Time
87 // Universal Coordinated Time = the new and politically correct name
93 Month names: Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec and
94 Inv_Month for an invalid month are the values of @c wxDateTime::Month enum.
96 Likewise, Sun, Mon, Tue, Wed, Thu, Fri, Sat, and Inv_WeekDay are the values
97 in @c wxDateTime::WeekDay enum.
99 Finally, Inv_Year is defined to be an invalid value for year parameter.
101 GetMonthName() and GetWeekDayName() functions use the following flags:
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
124 the country whose conventions should be used using SetCountry(). It takes
125 one of the following values as parameter:
130 Country_Unknown, // no special information for this country
131 Country_Default, // set the default country with SetCountry() method
132 // or use the default country with any other
134 Country_WesternEurope_Start,
135 Country_EEC = Country_WesternEurope_Start,
139 Country_WesternEurope_End = UK,
147 Different parts of the world use different conventions for the week start.
148 In some countries, the week starts on Sunday, while in others -- on Monday.
149 The ISO standard doesn't address this issue, so we support both conventions
150 in the functions whose result depends on it (GetWeekOfYear() and
153 The desired behvaiour may be specified by giving one of the following
154 constants as argument to these functions:
159 Default_First, // Sunday_First for US, Monday_First for the rest
160 Monday_First, // week starts with a Monday
161 Sunday_First // week starts with a Sunday
166 @section datetime_static Static Functions
168 All static functions either set or return the static variables of
169 wxDateSpan (the country), return the current moment, year, month or number
170 of days in it, or do some general calendar-related actions.
172 Please note that although several function accept an extra Calendar
173 parameter, it is currently ignored as only the Gregorian calendar is
174 supported. Future versions will support other calendars.
177 These methods are standalone functions named
178 "wxDateTime_<StaticMethodName>" in wxPython.
182 @section datetime_formatting Date Formatting and Parsing
184 The date formatting and parsing functions convert wxDateTime objects to and
185 from text. The conversions to text are mostly trivial: you can either do it
186 using the default date and time representations for the current locale
187 (FormatDate() and FormatTime()), using the international standard
188 representation defined by ISO 8601 (FormatISODate(), FormatISOTime() and
189 FormatISOCombined()) or by specifying any format at all and using Format()
192 The conversions from text are more interesting, as there are much more
193 possibilities to care about. The simplest cases can be taken care of with
194 ParseFormat() which can parse any date in the given (rigid) format.
195 ParseRfc822Date() is another function for parsing dates in predefined
196 format -- the one of RFC 822 which (still...) defines the format of email
197 messages on the Internet. This format can not be described with
198 @c strptime(3)-like format strings used by Format(), hence the need for a
201 But the most interesting functions are ParseTime(), ParseDate() and
202 ParseDateTime(). They try to parse the date and time (or only one of them)
203 in 'free' format, i.e. allow them to be specified in any of possible ways.
204 These functions will usually be used to parse the (interactive) user input
205 which is not bound to be in any predefined format. As an example,
206 ParseDateTime() can parse the strings such as "tomorrow", "March first" and
209 Finally notice that each of the parsing functions is available in several
210 overloads: if the input string is a narrow (@c char *) string, then a
211 narrow pointer is returned. If the input string is a wide string, a wide
212 char pointer is returned. Finally, if the input parameter is a wxString, a
213 narrow char pointer is also returned for backwards compatibility but there
214 is also an additional argument of wxString::const_iterator type in which,
215 if it is not @NULL, an iterator pointing to the end of the scanned string
223 - ::wxDefaultDateTime
225 @see @ref overview_datetime, wxTimeSpan, wxDateSpan, wxCalendarCtrl
231 @name Constructors, Assignment Operators and Setters
233 Constructors and various Set() methods are collected here. If you
234 construct a date object from separate values for day, month and year,
235 you should use IsValid() method to check that the values were correct
236 as constructors can not return an error code.
241 Default constructor. Use one of the Set() functions to initialize the
249 This constructor is named "wxDateTimeFromTimeT" in wxPython.
252 wxDateTime
& wxDateTime(time_t timet
);
256 @beginWxPythonOnly Unsupported. @endWxPythonOnly
258 wxDateTime
& wxDateTime(const struct tm
& tm
);
263 This constructor is named "wxDateTimeFromJDN" in wxPython.
266 wxDateTime
& wxDateTime(double jdn
);
271 This constructor is named "wxDateTimeFromHMS" in wxPython.
274 wxDateTime
& wxDateTime(wxDateTime_t hour
, wxDateTime_t minute
= 0,
275 wxDateTime_t second
= 0, wxDateTime_t millisec
= 0);
280 This constructor is named "wxDateTimeFromDMY" in wxPython.
283 wxDateTime(wxDateTime_t day
, Month month
= Inv_Month
,
284 int year
= Inv_Year
, wxDateTime_t hour
= 0,
285 wxDateTime_t minute
= 0, wxDateTime_t second
= 0,
286 wxDateTime_t millisec
= 0);
289 Reset time to midnight (00:00:00) without changing the date.
291 wxDateTime
& ResetTime();
294 Constructs the object from @a timet value holding the number of seconds
298 This method is named "SetTimeT" in wxPython.
301 wxDateTime
& Set(time_t timet
);
303 Sets the date and time from the broken down representation in the
304 standard @a tm structure.
306 @beginWxPythonOnly Unsupported. @endWxPythonOnly
308 wxDateTime
& Set(const struct tm
& tm
);
310 Sets the date from the so-called Julian Day Number.
312 By definition, the Julian Day Number, usually abbreviated as JDN, of a
313 particular instant is the fractional number of days since 12 hours
314 Universal Coordinated Time (Greenwich mean noon) on January 1 of the
315 year -4712 in the Julian proleptic calendar.
318 This method is named "SetJDN" in wxPython.
321 wxDateTime
& Set(double jdn
);
323 Sets the date to be equal to Today() and the time from supplied
327 This method is named "SetHMS" in wxPython.
330 wxDateTime
& Set(wxDateTime_t hour
, wxDateTime_t minute
= 0,
331 wxDateTime_t second
= 0, wxDateTime_t millisec
= 0);
333 Sets the date and time from the parameters.
335 wxDateTime
& Set(wxDateTime_t day
, Month month
= Inv_Month
,
336 int year
= Inv_Year
, wxDateTime_t hour
= 0,
337 wxDateTime_t minute
= 0, wxDateTime_t second
= 0,
338 wxDateTime_t millisec
= 0);
341 Sets the day without changing other date components.
343 wxDateTime
& SetDay(short unsigned int);
346 Sets the date from the date and time in DOS format.
348 wxDateTime
& SetFromDOS(unsigned long ddt
);
351 Sets the hour without changing other date components.
353 wxDateTime
& SetHour(short unsigned int);
356 Sets the millisecond without changing other date components.
358 wxDateTime
& SetMillisecond(short unsigned int);
361 Sets the minute without changing other date components.
363 wxDateTime
& SetMinute(short unsigned int);
366 Sets the month without changing other date components.
368 wxDateTime
& SetMonth(Month month
);
371 Sets the second without changing other date components.
373 wxDateTime
& SetSecond(short unsigned int);
376 Sets the date and time of to the current values. Same as assigning the
377 result of Now() to this object.
379 wxDateTime
& SetToCurrent();
382 Sets the year without changing other date components.
384 wxDateTime
& SetYear(int year
);
389 wxDateTime
& operator=(time_t timet
);
393 wxDateTime
& operator=(const struct tm
& tm
);
402 Here are the trivial accessors. Other functions, which might have to
403 perform some more complicated calculations to find the answer are under
404 the "Date Arithmetics" section.
409 Returns the date and time in DOS format.
411 long unsigned int GetAsDOS() const;
414 Returns the century of this date.
416 int GetCentury(const TimeZone
& tz
= Local
) const;
419 Returns the object having the same date component as this one but time
426 wxDateTime
GetDateOnly() const;
429 Returns the day in the given timezone (local one by default).
431 short unsigned int GetDay(const TimeZone
& tz
= Local
) const;
434 Returns the day of the year (in 1-366 range) in the given timezone
435 (local one by default).
437 short unsigned int GetDayOfYear(const TimeZone
& tz
= Local
) const;
440 Returns the hour in the given timezone (local one by default).
442 short unsigned int GetHour(const TimeZone
& tz
= Local
) const;
445 Returns the milliseconds in the given timezone (local one by default).
447 short unsigned int GetMillisecond(const TimeZone
& tz
= Local
) const;
450 Returns the minute in the given timezone (local one by default).
452 short unsigned int GetMinute(const TimeZone
& tz
= Local
) const;
455 Returns the month in the given timezone (local one by default).
457 Month
GetMonth(const TimeZone
& tz
= Local
) const;
460 Returns the seconds in the given timezone (local one by default).
462 short unsigned int GetSecond(const TimeZone
& tz
= Local
) const;
465 Returns the number of seconds since Jan 1, 1970. An assert failure will
466 occur if the date is not in the range covered by @c time_t type.
468 time_t GetTicks() const;
471 Returns broken down representation of the date and time.
473 Tm
GetTm(const TimeZone
& tz
= Local
) const;
476 Returns the week day in the given timezone (local one by default).
478 WeekDay
GetWeekDay(const TimeZone
& tz
= Local
) const;
481 Returns the ordinal number of the week in the month (in 1-5 range).
483 As GetWeekOfYear(), this function supports both conventions for the
484 week start. See the description of these @c WeekFlags in the
485 @ref datetime_constants section.
487 wxDateTime_t
GetWeekOfMonth(WeekFlags flags
= Monday_First
,
488 const TimeZone
& tz
= Local
) const;
491 Returns the number of the week of the year this date is in. The first
492 week of the year is, according to international standards, the one
493 containing Jan 4 or, equivalently, the first week which has Thursday in
494 this year. Both of these definitions are the same as saying that the
495 first week of the year must contain more than half of its days in this
496 year. Accordingly, the week number will always be in 1-53 range (52 for
499 The function depends on the @ref datetime_constants "week start"
500 convention specified by the @a flags argument but its results for
501 @c Sunday_First are not well-defined as the ISO definition quoted above
502 applies to the weeks starting on Monday only.
504 wxDateTime_t
GetWeekOfYear(WeekFlags flags
= Monday_First
,
505 const TimeZone
& tz
= Local
) const;
508 Returns the year in the given timezone (local one by default).
510 int GetYear(const TimeZone
& tz
= Local
) const;
513 Returns @true if the given date is later than the date of adoption of
514 the Gregorian calendar in the given country (and hence the Gregorian
515 calendar calculations make sense for it).
517 bool IsGregorianDate(GregorianAdoption country
= Gr_Standard
) const;
520 Returns @true if the object represents a valid time moment.
522 bool IsValid() const;
525 Returns @true is this day is not a holiday in the given country.
527 bool IsWorkDay(Country country
= Country_Default
) const;
534 @name Date Comparison
536 There are several functions to allow date comparison. To supplement
537 them, a few global operators, etc taking wxDateTime are defined.
542 Returns @true if this date precedes the given one.
544 bool IsEarlierThan(const wxDateTime
& datetime
) const;
547 Returns @true if the two dates are strictly identical.
549 bool IsEqualTo(const wxDateTime
& datetime
) const;
552 Returns @true if the date is equal to another one up to the given time
553 interval, i.e. if the absolute difference between the two dates is less
556 bool IsEqualUpTo(const wxDateTime
& dt
, const wxTimeSpan
& ts
) const;
559 Returns @true if this date is later than the given one.
561 bool IsLaterThan(const wxDateTime
& datetime
) const;
564 Returns @true if the date is the same without comparing the time parts.
566 bool IsSameDate(const wxDateTime
& dt
) const;
569 Returns @true if the time is the same (although dates may differ).
571 bool IsSameTime(const wxDateTime
& dt
) const;
574 Returns @true if this date lies strictly between the two given dates.
578 bool IsStrictlyBetween(const wxDateTime
& t1
,
579 const wxDateTime
& t2
) const;
582 Returns @true if IsStrictlyBetween() is @true or if the date is equal
583 to one of the limit values.
585 @see IsStrictlyBetween()
587 bool IsBetween(const wxDateTime
& t1
, const wxDateTime
& t2
) const;
594 @name Date Arithmetics
596 These functions carry out
597 @ref overview_datetime_arithmetics "arithmetics" on the wxDateTime
598 objects. As explained in the overview, either wxTimeSpan or wxDateSpan
599 may be added to wxDateTime, hence all functions are overloaded to
600 accept both arguments.
602 Also, both Add() and Subtract() have both const and non-const version.
603 The first one returns a new object which represents the sum/difference
604 of the original one with the argument while the second form modifies
605 the object to which it is applied. The operators "-=" and "+=" are
606 defined to be equivalent to the second forms of these functions.
611 Adds the given date span to this object.
614 This method is named "AddDS" in wxPython.
617 wxDateTime
Add(const wxDateSpan
& diff
) const;
619 Adds the given date span to this object.
622 This method is named "AddDS" in wxPython.
625 wxDateTime
Add(const wxDateSpan
& diff
);
627 Adds the given time span to this object.
630 This method is named "AddTS" in wxPython.
633 wxDateTime
Add(const wxTimeSpan
& diff
) const;
635 Adds the given time span to this object.
638 This method is named "AddTS" in wxPython.
641 wxDateTime
& Add(const wxTimeSpan
& diff
);
644 Subtracts the given time span from this object.
647 This method is named "SubtractTS" in wxPython.
650 wxDateTime
Subtract(const wxTimeSpan
& diff
) const;
652 Subtracts the given time span from this object.
655 This method is named "SubtractTS" in wxPython.
658 wxDateTime
& Subtract(const wxTimeSpan
& diff
);
660 Subtracts the given date span from this object.
663 This method is named "SubtractDS" in wxPython.
666 wxDateTime
Subtract(const wxDateSpan
& diff
) const;
668 Subtracts the given date span from this object.
671 This method is named "SubtractDS" in wxPython.
674 wxDateTime
& Subtract(const wxDateSpan
& diff
);
676 Subtracts another date from this one and returns the difference between
677 them as a wxTimeSpan.
679 wxTimeSpan
Subtract(const wxDateTime
& dt
) const;
682 Adds the given date span to this object.
684 wxDateTime
operator+=(const wxDateSpan
& diff
);
686 Subtracts the given date span from this object.
688 wxDateTime
& operator-=(const wxDateSpan
& diff
);
690 Adds the given time span to this object.
692 wxDateTime
& operator+=(const wxTimeSpan
& diff
);
694 Subtracts the given time span from this object.
696 wxDateTime
& operator-=(const wxTimeSpan
& diff
);
703 @name Date Formatting and Parsing
705 See @ref datetime_formatting
710 This function does the same as the standard ANSI C @c strftime(3)
711 function. Please see its description for the meaning of @a format
714 It also accepts a few wxWidgets-specific extensions: you can optionally
715 specify the width of the field to follow using @c printf(3)-like syntax
716 and the format specification @c "%l" can be used to get the number of
721 wxString
Format(const wxChar
* format
= wxDefaultDateTimeFormat
,
722 const TimeZone
& tz
= Local
) const;
725 Identical to calling Format() with @c "%x" argument (which means
726 "preferred date representation for the current locale").
728 wxString
FormatDate() const;
731 Returns the combined date-time representation in the ISO 8601 format
732 @c "YYYY-MM-DDTHH:MM:SS". The @a sep parameter default value produces
733 the result exactly corresponding to the ISO standard, but it can also
734 be useful to use a space as seprator if a more human-readable combined
735 date-time representation is needed.
737 @see FormatISODate(), FormatISOTime(), ParseISOCombined()
739 wxString
FormatISOCombined(char sep
= 'T') const;
742 This function returns the date representation in the ISO 8601 format
745 wxString
FormatISODate() const;
748 This function returns the time representation in the ISO 8601 format
751 wxString
FormatISOTime() const;
754 Identical to calling Format() with @c "%X" argument (which means
755 "preferred time representation for the current locale").
757 wxString
FormatTime() const;
760 This function is like ParseDateTime(), but it only allows the date to
761 be specified. It is thus less flexible then ParseDateTime(), but also
762 has less chances to misinterpret the user input.
764 @returns @NULL if the conversion failed, otherwise return the pointer
765 to the character which stopped the scan.
767 const char* ParseDate(const wxString
& date
,
768 wxString::const_iterator
* end
= NULL
);
770 This function is like ParseDateTime(), but it only allows the date to
771 be specified. It is thus less flexible then ParseDateTime(), but also
772 has less chances to misinterpret the user input.
774 @returns @NULL if the conversion failed, otherwise return the pointer
775 to the character which stopped the scan.
777 const char* ParseDate(const char* date
);
779 This function is like ParseDateTime(), but it only allows the date to
780 be specified. It is thus less flexible then ParseDateTime(), but also
781 has less chances to misinterpret the user input.
783 @returns @NULL if the conversion failed, otherwise return the pointer
784 to the character which stopped the scan.
786 const wchar_t* ParseDate(const wchar_t* date
);
789 Parses the string @a datetime containing the date and time in free
790 format. This function tries as hard as it can to interpret the given
791 string as date and time. Unlike ParseRfc822Date(), it will accept
792 anything that may be accepted and will only reject strings which can
793 not be parsed in any way at all.
795 @returns @NULL if the conversion failed, otherwise return the pointer
796 to the character which stopped the scan.
798 const char* ParseDateTime(const wxString
& datetime
,
799 wxString::const_iterator
* end
= NULL
);
801 Parses the string @a datetime containing the date and time in free
802 format. This function tries as hard as it can to interpret the given
803 string as date and time. Unlike ParseRfc822Date(), it will accept
804 anything that may be accepted and will only reject strings which can
805 not be parsed in any way at all.
807 @returns @NULL if the conversion failed, otherwise return the pointer
808 to the character which stopped the scan.
810 const char* ParseDateTime(const char* datetime
);
812 Parses the string @a datetime containing the date and time in free
813 format. This function tries as hard as it can to interpret the given
814 string as date and time. Unlike ParseRfc822Date(), it will accept
815 anything that may be accepted and will only reject strings which can
816 not be parsed in any way at all.
818 @returns @NULL if the conversion failed, otherwise return the pointer
819 to the character which stopped the scan.
821 const wchar_t* ParseDateTime(const wchar_t* datetime
);
824 This function parses the string @a date according to the given
825 @e format. The system @c strptime(3) function is used whenever
826 available, but even if it is not, this function is still implemented,
827 although support for locale-dependent format specifiers such as
828 @c "%c", @c "%x" or @c "%X" may not be perfect and GNU extensions such
829 as @c "%z" and @c "%Z" are not implemented. This function does handle
830 the month and weekday names in the current locale on all platforms,
833 Please see the description of the ANSI C function @c strftime(3) for
834 the syntax of the format string.
836 The @a dateDef parameter is used to fill in the fields which could not
837 be determined from the format string. For example, if the format is
838 @c "%d" (the day of the month), the month and the year are taken from
839 @a dateDef. If it is not specified, Today() is used as the default
842 @returns @NULL if the conversion failed, otherwise return the pointer
843 to the character which stopped the scan.
845 const char* ParseFormat(const wxString
& date
,
846 const wxString
& format
= wxDefaultDateTimeFormat
,
847 const wxDateTime
& dateDef
= wxDefaultDateTime
,
848 wxString::const_iterator
* end
= NULL
);
850 This function parses the string @a date according to the given
851 @e format. The system @c strptime(3) function is used whenever
852 available, but even if it is not, this function is still implemented,
853 although support for locale-dependent format specifiers such as
854 @c "%c", @c "%x" or @c "%X" may not be perfect and GNU extensions such
855 as @c "%z" and @c "%Z" are not implemented. This function does handle
856 the month and weekday names in the current locale on all platforms,
859 Please see the description of the ANSI C function @c strftime(3) for
860 the syntax of the format string.
862 The @a dateDef parameter is used to fill in the fields which could not
863 be determined from the format string. For example, if the format is
864 @c "%d" (the day of the month), the month and the year are taken from
865 @a dateDef. If it is not specified, Today() is used as the default
868 @returns @NULL if the conversion failed, otherwise return the pointer
869 to the character which stopped the scan.
871 const char* ParseFormat(const char* date
,
872 const wxString
& format
= wxDefaultDateTimeFormat
,
873 const wxDateTime
& dateDef
= wxDefaultDateTime
);
875 This function parses the string @a date according to the given
876 @e format. The system @c strptime(3) function is used whenever
877 available, but even if it is not, this function is still implemented,
878 although support for locale-dependent format specifiers such as
879 @c "%c", @c "%x" or @c "%X" may not be perfect and GNU extensions such
880 as @c "%z" and @c "%Z" are not implemented. This function does handle
881 the month and weekday names in the current locale on all platforms,
884 Please see the description of the ANSI C function @c strftime(3) for
885 the syntax of the format string.
887 The @a dateDef parameter is used to fill in the fields which could not
888 be determined from the format string. For example, if the format is
889 @c "%d" (the day of the month), the month and the year are taken from
890 @a dateDef. If it is not specified, Today() is used as the default
893 @returns @NULL if the conversion failed, otherwise return the pointer
894 to the character which stopped the scan.
896 const wchar_t* ParseFormat(const wchar_t* date
,
897 const wxString
& format
= wxDefaultDateTimeFormat
,
898 const wxDateTime
& dateDef
= wxDefaultDateTime
);
901 This function parses the string containing the date and time in ISO
902 8601 combined format @c "YYYY-MM-DDTHH:MM:SS". The separator between
903 the date and time parts must be equal to @a sep for the function to
906 @returns @true if the entire string was parsed successfully, @false
909 bool ParseISOCombined(const wxString
& date
, char sep
= 'T');
912 This function parses the date in ISO 8601 format @c "YYYY-MM-DD".
914 @returns @true if the entire string was parsed successfully, @false
917 bool ParseISODate(const wxString
& date
);
920 This function parses the time in ISO 8601 format @c "HH:MM:SS".
922 @returns @true if the entire string was parsed successfully, @false
925 bool ParseISOTime(const wxString
& date
);
928 Parses the string @a date looking for a date formatted according to the
929 RFC 822 in it. The exact description of this format may, of course, be
930 found in the RFC (section 5), but, briefly, this is the format used in
931 the headers of Internet email messages and one of the most common
932 strings expressing date in this format may be something like
933 @c "Sat, 18 Dec 1999 00:48:30 +0100".
935 Returns @NULL if the conversion failed, otherwise return the pointer to
936 the character immediately following the part of the string which could
937 be parsed. If the entire string contains only the date in RFC 822
938 format, the returned pointer will be pointing to a @c NUL character.
940 This function is intentionally strict, it will return an error for any
941 string which is not RFC 822 compliant. If you need to parse date
942 formatted in more free ways, you should use ParseDateTime() or
945 const char* ParseRfc822Date(const wxString
& date
,
946 wxString::const_iterator
* end
= NULL
);
948 Parses the string @a date looking for a date formatted according to the
949 RFC 822 in it. The exact description of this format may, of course, be
950 found in the RFC (section 5), but, briefly, this is the format used in
951 the headers of Internet email messages and one of the most common
952 strings expressing date in this format may be something like
953 @c "Sat, 18 Dec 1999 00:48:30 +0100".
955 Returns @NULL if the conversion failed, otherwise return the pointer to
956 the character immediately following the part of the string which could
957 be parsed. If the entire string contains only the date in RFC 822
958 format, the returned pointer will be pointing to a @c NUL character.
960 This function is intentionally strict, it will return an error for any
961 string which is not RFC 822 compliant. If you need to parse date
962 formatted in more free ways, you should use ParseDateTime() or
965 const char* ParseRfc822Date(const char* date
);
967 Parses the string @a date looking for a date formatted according to the
968 RFC 822 in it. The exact description of this format may, of course, be
969 found in the RFC (section 5), but, briefly, this is the format used in
970 the headers of Internet email messages and one of the most common
971 strings expressing date in this format may be something like
972 @c "Sat, 18 Dec 1999 00:48:30 +0100".
974 Returns @NULL if the conversion failed, otherwise return the pointer to
975 the character immediately following the part of the string which could
976 be parsed. If the entire string contains only the date in RFC 822
977 format, the returned pointer will be pointing to a @c NUL character.
979 This function is intentionally strict, it will return an error for any
980 string which is not RFC 822 compliant. If you need to parse date
981 formatted in more free ways, you should use ParseDateTime() or
984 const wchar_t* ParseRfc822Date(const wchar_t* date
);
987 This functions is like ParseDateTime(), but only allows the time to be
988 specified in the input string.
990 @returns @NULL if the conversion failed, otherwise return the pointer
991 to the character which stopped the scan.
993 const char* ParseTime(const wxString
& time
,
994 wxString::const_iterator
* end
= NULL
);
996 This functions is like ParseDateTime(), but only allows the time to be
997 specified in the input string.
999 @returns @NULL if the conversion failed, otherwise return the pointer
1000 to the character which stopped the scan.
1002 const char* ParseTime(const char* time
);
1004 This functions is like ParseDateTime(), but only allows the time to be
1005 specified in the input string.
1007 @returns @NULL if the conversion failed, otherwise return the pointer
1008 to the character which stopped the scan.
1010 const wchar_t* ParseTime(const wchar_t* time
);
1017 @name Calendar Calculations
1019 The functions in this section perform the basic calendar calculations,
1020 mostly related to the week days. They allow to find the given week day
1021 in the week with given number (either in the month or in the year) and
1024 None of the functions in this section modify the time part of the
1025 wxDateTime, they only work with the date part of it.
1030 Returns the copy of this object to which SetToLastMonthDay() was
1033 wxDateTime
GetLastMonthDay(Month month
= Inv_Month
,
1034 int year
= Inv_Year
) const;
1037 Returns the copy of this object to which SetToLastWeekDay() was
1040 wxDateTime
GetLastWeekDay(WeekDay weekday
, Month month
= Inv_Month
,
1041 int year
= Inv_Year
);
1044 Returns the copy of this object to which SetToNextWeekDay() was
1047 wxDateTime
GetNextWeekDay(WeekDay weekday
) const;
1050 Returns the copy of this object to which SetToPrevWeekDay() was
1053 wxDateTime
GetPrevWeekDay(WeekDay weekday
) const;
1056 Returns the copy of this object to which SetToWeekDay() was applied.
1058 wxDateTime
GetWeekDay(WeekDay weekday
, int n
= 1, Month month
= Inv_Month
,
1059 int year
= Inv_Year
) const;
1062 Returns the copy of this object to which SetToWeekDayInSameWeek() was
1065 wxDateTime
GetWeekDayInSameWeek(WeekDay weekday
,
1066 WeekFlags flags
= Monday_First
) const;
1069 Returns the copy of this object to which SetToYearDay() was applied.
1071 wxDateTime
GetYearDay(wxDateTime_t yday
) const;
1074 Sets the date to the last day in the specified month (the current one
1077 @returns The reference to the modified object itself.
1079 wxDateTime
SetToLastMonthDay(Month month
= Inv_Month
,
1080 int year
= Inv_Year
);
1083 The effect of calling this function is the same as of calling
1084 @c SetToWeekDay(-1, weekday, month, year). The date will be set to the
1085 last @a weekday in the given month and year (the current ones by
1086 default). Always returns @true.
1088 bool SetToLastWeekDay(WeekDay weekday
, Month month
= Inv_Month
,
1089 int year
= Inv_Year
);
1092 Sets the date so that it will be the first @a weekday following the
1095 @returns The reference to the modified object itself.
1097 wxDateTime
& SetToNextWeekDay(WeekDay weekday
);
1100 Sets the date so that it will be the last @a weekday before the current
1103 @returns The reference to the modified object itself.
1105 wxDateTime
& SetToPrevWeekDay(WeekDay weekday
);
1108 Sets the date to the @e n-th @a weekday in the given month of the given
1109 year (the current month and year are used by default). The parameter
1110 @a n may be either positive (counting from the beginning of the month)
1111 or negative (counting from the end of it).
1113 For example, SetToWeekDay(2, wxDateTime::Wed) will set the date to the
1114 second Wednesday in the current month and
1115 SetToWeekDay(-1, wxDateTime::Sun) will set the date to the last Sunday
1116 in the current month.
1118 @returns @true if the date was modified successfully, @false otherwise
1119 meaning that the specified date doesn't exist.
1121 bool SetToWeekDay(WeekDay weekday
, int n
= 1,
1122 Month month
= Inv_Month
, int year
= Inv_Year
);
1125 Adjusts the date so that it will still lie in the same week as before,
1126 but its week day will be the given one.
1128 @returns The reference to the modified object itself.
1130 wxDateTime
SetToWeekDayInSameWeek(WeekDay weekday
,
1131 WeekFlags flags
= Monday_First
);
1134 Sets the date to the day number @a yday in the same year (i.e., unlike
1135 the other functions, this one does not use the current year). The day
1136 number should be in the range 1-366 for the leap years and 1-365 for
1139 @returns The reference to the modified object itself.
1141 wxDateTime
& SetToYearDay(wxDateTime_t yday
);
1148 @name Astronomical/Historical Functions
1150 Some degree of support for the date units used in astronomy and/or
1151 history is provided. You can construct a wxDateTime object from a
1152 JDN and you may also get its JDN, MJD or Rata Die number from it.
1154 Related functions in other groups: wxDateTime(double), Set(double)
1159 Synonym for GetJulianDayNumber().
1161 double GetJDN() const;
1164 Returns the JDN corresponding to this date. Beware of rounding errors!
1166 @see GetModifiedJulianDayNumber()
1168 double GetJulianDayNumber() const;
1171 Synonym for GetModifiedJulianDayNumber().
1173 double GetMJD() const;
1176 Returns the @e "Modified Julian Day Number" (MJD) which is, by
1177 definition, is equal to JDN - 2400000.5. The MJDs are simpler to work
1178 with as the integral MJDs correspond to midnights of the dates in the
1179 Gregorian calendar and not the noons like JDN. The MJD 0 represents
1182 double GetModifiedJulianDayNumber() const;
1185 Return the @e Rata Die number of this date.
1187 By definition, the Rata Die number is a date specified as the number of
1188 days relative to a base date of December 31 of the year 0. Thus January
1189 1 of the year 1 is Rata Die day 1.
1191 double GetRataDie() const;
1198 @name Time Zone and DST Support
1200 Please see the @ref overview_datetime_timezones "time zone overview"
1201 for more information about time zones. Normally, these functions should
1204 Related functions in other groups: GetBeginDST(), GetEndDST()
1209 Transform the date from the given time zone to the local one. If
1210 @a noDST is @true, no DST adjustments will be made.
1212 @returns The date in the local time zone.
1214 wxDateTime
FromTimezone(const TimeZone
& tz
, bool noDST
= false) const;
1217 Returns @true if the DST is applied for this date in the given country.
1219 @see GetBeginDST(), GetEndDST()
1221 int IsDST(Country country
= Country_Default
) const;
1224 Same as FromTimezone() but modifies the object in place.
1226 wxDateTime
MakeFromTimezone(const TimeZone
& tz
, bool noDST
= false);
1229 Modifies the object in place to represent the date in another time
1230 zone. If @a noDST is @true, no DST adjustments will be made.
1232 wxDateTime
MakeTimezone(const TimeZone
& tz
, bool noDST
= false);
1235 This is the same as calling MakeTimezone() with the argument @c GMT0.
1237 wxDateTime
& MakeUTC(bool noDST
= false);
1240 Transform the date to the given time zone. If @a noDST is @true, no DST
1241 adjustments will be made.
1243 @returns The date in the new time zone.
1245 wxDateTime
ToTimezone(const TimeZone
& tz
, bool noDST
= false) const;
1248 This is the same as calling ToTimezone() with the argument @c GMT0.
1250 wxDateTime
ToUTC(bool noDST
= false) const;
1259 Converts the year in absolute notation (i.e. a number which can be
1260 negative, positive or zero) to the year in BC/AD notation. For the
1261 positive years, nothing is done, but the year 0 is year 1 BC and so for
1262 other years there is a difference of 1.
1264 This function should be used like this:
1268 int y = dt.GetYear();
1269 printf("The year is %d%s", wxDateTime::ConvertYearToBC(y), y > 0 ? "AD" : "BC");
1272 static int ConvertYearToBC(int year
);
1275 Returns the translations of the strings @c AM and @c PM used for time
1276 formatting for the current locale. Either of the pointers may be @NULL
1277 if the corresponding value is not needed.
1279 static void GetAmPmStrings(wxString
* am
, wxString
* pm
);
1282 Get the beginning of DST for the given country in the given year
1283 (current one by default). This function suffers from limitations
1284 described in the @ref overview_datetime_dst "DST overview".
1288 static wxDateTime
GetBeginDST(int year
= Inv_Year
,
1289 Country country
= Country_Default
);
1292 Returns the end of DST for the given country in the given year (current
1297 static wxDateTime
GetEndDST(int year
= Inv_Year
,
1298 Country country
= Country_Default
);
1301 Get the current century, i.e. first two digits of the year, in given
1302 calendar (only Gregorian is currently supported).
1304 static int GetCentury(int year
);
1307 Returns the current default country. The default country is used for
1308 DST calculations, for example.
1312 static Country
GetCountry();
1315 Get the current month in given calendar (only Gregorian is currently
1318 static Month
GetCurrentMonth(Calendar cal
= Gregorian
);
1321 Get the current year in given calendar (only Gregorian is currently
1324 static int GetCurrentYear(Calendar cal
= Gregorian
);
1327 Gets the full (default) or abbreviated (specify @c Name_Abbr name of
1330 @see GetWeekDayName()
1332 static wxString
GetMonthName(Month month
, NameFlags flags
= Name_Full
);
1335 Returns the number of days in the given year. The only supported value
1336 for @a cal currently is @c Gregorian.
1339 This method is named "GetNumberOfDaysInYear" in wxPython.
1342 static wxDateTime_t
GetNumberOfDays(int year
, Calendar cal
= Gregorian
);
1345 Returns the number of days in the given month of the given year. The
1346 only supported value for @a cal currently is @c Gregorian.
1349 This method is named "GetNumberOfDaysInMonth" in wxPython.
1352 static wxDateTime_t
GetNumberOfDays(Month month
, int year
= Inv_Year
,
1353 Calendar cal
= Gregorian
);
1356 Returns the current time.
1358 static time_t GetTimeNow();
1361 Returns the current time broken down using the buffer whose adress is
1362 passed to the function with @a tm to store the result.
1364 static struct tm
* GetTmNow(struct tm
*tm
);
1367 Returns the current time broken down. Note that this function returns a
1368 pointer to a static buffer that's reused by calls to this function and
1369 certain C library functions (e.g. localtime). If there is any chance
1370 your code might be used in a multi-threaded application, you really
1371 should use GetTmNow(struct tm *) instead.
1373 static struct tm
* GetTmNow();
1376 Gets the full (default) or abbreviated (specify @c Name_Abbr) name of
1381 static wxString
GetWeekDayName(WeekDay weekday
,
1382 NameFlags flags
= Name_Full
);
1385 Returns @true if DST was used n the given year (the current one by
1386 default) in the given country.
1388 static bool IsDSTApplicable(int year
= Inv_Year
,
1389 Country country
= Country_Default
);
1392 Returns @true if the @a year is a leap one in the specified calendar.
1393 This functions supports Gregorian and Julian calendars.
1395 static bool IsLeapYear(int year
= Inv_Year
, Calendar cal
= Gregorian
);
1398 This function returns @true if the specified (or default) country is
1399 one of Western European ones. It is used internally by wxDateTime to
1400 determine the DST convention and date and time formatting rules.
1402 static bool IsWestEuropeanCountry(Country country
= Country_Default
);
1405 Returns the object corresponding to the current time.
1410 wxDateTime now = wxDateTime::Now();
1411 printf("Current time in Paris:\t%s\n", now.Format("%c", wxDateTime::CET).c_str());
1414 @note This function is accurate up to seconds. UNow() should be used
1415 for better precision, but it is less efficient and might not be
1416 available on all platforms.
1420 static wxDateTime
Now();
1423 Sets the country to use by default. This setting influences the DST
1424 calculations, date formatting and other things.
1426 The possible values for @a country parameter are enumerated in the
1427 @ref datetime_constants section.
1431 static void SetCountry(Country country
);
1434 Set the date to the given @a weekday in the week number @a numWeek of
1435 the given @a year . The number should be in range 1-53.
1437 Note that the returned date may be in a different year than the one
1438 passed to this function because both the week 1 and week 52 or 53 (for
1439 leap years) contain days from different years. See GetWeekOfYear() for
1440 the explanation of how the year weeks are counted.
1442 static wxDateTime
SetToWeekOfYear(int year
, wxDateTime_t numWeek
,
1443 WeekDay weekday
= Mon
);
1446 Returns the object corresponding to the midnight of the current day
1447 (i.e. the same as Now(), but the time part is set to 0).
1451 static wxDateTime
Today();
1454 Returns the object corresponding to the current time including the
1455 milliseconds if a function to get time with such precision is available
1456 on the current platform (supported under most Unices and Win32).
1460 static wxDateTime
UNow();
1464 Global instance of an empty wxDateTime object.
1466 @todo Would it be better to rename this wxNullDateTime so it's consistent
1467 with the rest of the "empty/invalid/null" global objects?
1469 const wxDateTime wxDefaultDateTime
;
1474 @class wxDateTimeWorkDays
1475 @wxheader{datetime.h}
1477 @todo Write wxDateTimeWorkDays documentation.
1482 class wxDateTimeWorkDays
1492 @wxheader{datetime.h}
1494 This class is a "logical time span" and is useful for implementing program
1495 logic for such things as "add one month to the date" which, in general,
1496 doesn't mean to add 60*60*24*31 seconds to it, but to take the same date
1497 the next month (to understand that this is indeed different consider adding
1498 one month to Feb, 15 -- we want to get Mar, 15, of course).
1500 When adding a month to the date, all lesser components (days, hours, ...)
1501 won't be changed unless the resulting date would be invalid: for example,
1502 Jan 31 + 1 month will be Feb 28, not (non-existing) Feb 31.
1504 Because of this feature, adding and subtracting back again the same
1505 wxDateSpan will @b not, in general, give back the original date: Feb 28 - 1
1506 month will be Jan 28, not Jan 31!
1508 wxDateSpan objects can be either positive or negative. They may be
1509 multiplied by scalars which multiply all deltas by the scalar: i.e.
1510 2*(1 month and 1 day) is 2 months and 2 days. They can be added together
1511 with wxDateTime or wxTimeSpan, but the type of result is different for each
1514 @warning If you specify both weeks and days, the total number of days added
1515 will be 7*weeks + days! See also GetTotalDays().
1517 Equality operators are defined for wxDateSpans. Two wxDateSpans are equal
1518 if and only if they both give the same target date when added to @b every
1519 source date. Thus wxDateSpan::Months(1) is not equal to
1520 wxDateSpan::Days(30), because they don't give the same date when added to
1521 Feb 1st. But wxDateSpan::Days(14) is equal to wxDateSpan::Weeks(2).
1523 Finally, notice that for adding hours, minutes and so on you don't need
1524 this class at all: wxTimeSpan will do the job because there are no
1525 subtleties associated with those (we don't support leap seconds).
1530 @see @ref overview_datetime, wxDateTime
1536 Constructs the date span object for the given number of years, months,
1537 weeks and days. Note that the weeks and days add together if both are
1540 wxDateSpan(int years
= 0, int months
= 0, int weeks
= 0, int days
= 0);
1543 Returns the sum of two date spans.
1545 @returns A new wxDateSpan object with the result.
1547 wxDateSpan
Add(const wxDateSpan
& other
) const;
1549 Adds the given wxDateSpan to this wxDateSpan and returns a reference
1552 wxDateSpan
& Add(const wxDateSpan
& other
);
1555 Returns a date span object corresponding to one day.
1559 static wxDateSpan
Day();
1562 Returns a date span object corresponding to the given number of days.
1566 static wxDateSpan
Days(int days
);
1569 Returns the number of days (not counting the weeks component) in this
1574 int GetDays() const;
1577 Returns the number of the months (not counting the years) in this date
1580 int GetMonths() const;
1583 Returns the combined number of days in this date span, counting both
1584 weeks and days. This doesn't take months or years into account.
1586 @see GetWeeks(), GetDays()
1588 int GetTotalDays() const;
1591 Returns the number of weeks in this date span.
1595 int GetWeeks() const;
1598 Returns the number of years in this date span.
1600 int GetYears() const;
1603 Returns a date span object corresponding to one month.
1607 static wxDateSpan
Month();
1610 Returns a date span object corresponding to the given number of months.
1614 static wxDateSpan
Months(int mon
);
1617 Returns the product of the date span by the specified @a factor. The
1618 product is computed by multiplying each of the components by the
1621 @returns A new wxDateSpan object with the result.
1623 wxDateSpan
Multiply(int factor
) const;
1625 Multiplies this date span by the specified @a factor. The product is
1626 computed by multiplying each of the components by the @a factor.
1628 @returns A reference to this wxDateSpan object modified in place.
1630 wxDateSpan
& Multiply(int factor
);
1633 Changes the sign of this date span.
1640 Returns a date span with the opposite sign.
1644 wxDateSpan
Negate() const;
1647 Sets the number of days (without modifying any other components) in
1650 wxDateSpan
& SetDays(int n
);
1653 Sets the number of months (without modifying any other components) in
1656 wxDateSpan
& SetMonths(int n
);
1659 Sets the number of weeks (without modifying any other components) in
1662 wxDateSpan
& SetWeeks(int n
);
1665 Sets the number of years (without modifying any other components) in
1668 wxDateSpan
& SetYears(int n
);
1671 Returns the difference of two date spans.
1673 @returns A new wxDateSpan object with the result.
1675 wxDateSpan
Subtract(const wxDateSpan
& other
) const;
1677 Subtracts the given wxDateSpan to this wxDateSpan and returns a
1678 reference to itself.
1680 wxDateSpan
& Subtract(const wxDateSpan
& other
);
1683 Returns a date span object corresponding to one week.
1687 static wxDateSpan
Week();
1690 Returns a date span object corresponding to the given number of weeks.
1694 static wxDateSpan
Weeks(int weeks
);
1697 Returns a date span object corresponding to one year.
1701 static wxDateSpan
Year();
1704 Returns a date span object corresponding to the given number of years.
1708 static wxDateSpan
Years(int years
);
1711 Adds the given wxDateSpan to this wxDateSpan and returns the result.
1713 wxDateSpan
& operator+=(const wxDateSpan
& other
);
1716 Subtracts the given wxDateSpan to this wxDateSpan and returns the
1719 wxDateSpan
& operator-=(const wxDateSpan
& other
);
1722 Changes the sign of this date span.
1726 wxDateSpan
& operator-();
1729 Multiplies this date span by the specified @a factor. The product is
1730 computed by multiplying each of the components by the @a factor.
1732 @returns A reference to this wxDateSpan object modified in place.
1734 wxDateSpan
& operator*=(int factor
);
1737 Returns @true if this date span is different from the other one.
1739 bool operator!=(const wxDateSpan
&) const;
1742 Returns @true if this date span is equal to the other one. Two date
1743 spans are considered equal if and only if they have the same number of
1744 years and months and the same total number of days (counting both days
1747 bool operator==(const wxDateSpan
&) const;
1754 @wxheader{datetime.h}
1756 wxTimeSpan class represents a time interval.
1761 @see @ref overview_datetime, wxDateTime
1767 Default constructor, constructs a zero timespan.
1771 Constructs timespan from separate values for each component, with the
1772 date set to 0. Hours are not restricted to 0-24 range, neither are
1773 minutes, seconds or milliseconds.
1775 wxTimeSpan(long hours
, long min
, long sec
, long msec
);
1778 Returns the absolute value of the timespan: does not modify the object.
1780 wxTimeSpan
Abs() const;
1783 Returns the sum of two time spans.
1785 @returns A new wxDateSpan object with the result.
1787 wxTimeSpan
Add(const wxTimeSpan
& diff
) const;
1789 Adds the given wxTimeSpan to this wxTimeSpan and returns a reference
1792 wxTimeSpan
& Add(const wxTimeSpan
& diff
);
1795 Returns the timespan for one day.
1797 static wxTimespan
Day();
1800 Returns the timespan for the given number of days.
1802 static wxTimespan
Days(long days
);
1805 Returns the string containing the formatted representation of the time
1806 span. The following format specifiers are allowed after %:
1808 - @c H - Number of Hours
1809 - @c M - Number of Minutes
1810 - @c S - Number of Seconds
1811 - @c l - Number of Milliseconds
1812 - @c D - Number of Days
1813 - @c E - Number of Weeks
1814 - @c % - The percent character
1816 Note that, for example, the number of hours in the description above is
1817 not well defined: it can be either the total number of hours (for
1818 example, for a time span of 50 hours this would be 50) or just the hour
1819 part of the time span, which would be 2 in this case as 50 hours is
1820 equal to 2 days and 2 hours.
1822 wxTimeSpan resolves this ambiguity in the following way: if there had
1823 been, indeed, the @c %D format specified preceding the @c %H, then it
1824 is interpreted as 2. Otherwise, it is 50.
1826 The same applies to all other format specifiers: if they follow a
1827 specifier of larger unit, only the rest part is taken, otherwise the
1830 wxString
Format(const wxString
& = wxDefaultTimeSpanFormat
) const;
1833 Returns the difference in number of days.
1835 int GetDays() const;
1838 Returns the difference in number of hours.
1840 int GetHours() const;
1843 Returns the difference in number of milliseconds.
1845 wxLongLong
GetMilliseconds() const;
1848 Returns the difference in number of minutes.
1850 int GetMinutes() const;
1853 Returns the difference in number of seconds.
1855 wxLongLong
GetSeconds() const;
1858 Returns the internal representation of timespan.
1860 wxLongLong
GetValue() const;
1863 Returns the difference in number of weeks.
1865 int GetWeeks() const;
1868 Returns the timespan for one hour.
1870 static wxTimespan
Hour();
1873 Returns the timespan for the given number of hours.
1875 static wxTimespan
Hours(long hours
);
1878 Returns @true if two timespans are equal.
1880 bool IsEqualTo(const wxTimeSpan
& ts
) const;
1883 Compares two timespans: works with the absolute values, i.e. -2 hours
1884 is longer than 1 hour. Also, it will return @false if the timespans are
1885 equal in absolute value.
1887 bool IsLongerThan(const wxTimeSpan
& ts
) const;
1890 Returns @true if the timespan is negative.
1892 bool IsNegative() const;
1895 Returns @true if the timespan is empty.
1897 bool IsNull() const;
1900 Returns @true if the timespan is positive.
1902 bool IsPositive() const;
1905 Compares two timespans: works with the absolute values, i.e. 1 hour is
1906 shorter than -2 hours. Also, it will return @false if the timespans are
1907 equal in absolute value.
1909 bool IsShorterThan(const wxTimeSpan
& ts
) const;
1912 Returns the timespan for one millisecond.
1914 static wxTimespan
Millisecond();
1917 Returns the timespan for the given number of milliseconds.
1919 static wxTimespan
Milliseconds(long ms
);
1922 Returns the timespan for one minute.
1924 static wxTimespan
Minute();
1927 Returns the timespan for the given number of minutes.
1929 static wxTimespan
Minutes(long min
);
1932 Returns the product of this time span by @a n.
1934 @returns A new wxTimeSpan object with the result.
1936 wxTimeSpan
Multiply(int n
) const;
1938 Multiplies this time span by @a n.
1940 @returns A reference to this wxTimeSpan object modified in place.
1942 wxTimeSpan
& Multiply(int n
);
1945 Negate the value of the timespan.
1952 Returns timespan with inverted sign.
1956 wxTimeSpan
Negate() const;
1959 Returns the timespan for one second.
1961 static wxTimespan
Second();
1964 Returns the timespan for the given number of seconds.
1966 static wxTimespan
Seconds(long sec
);
1969 Returns the difference of two time spans.
1971 @returns A new wxDateSpan object with the result.
1973 wxTimeSpan
Subtract(const wxTimeSpan
& diff
) const;
1975 Subtracts the given wxTimeSpan to this wxTimeSpan and returns a
1976 reference to itself.
1978 wxTimeSpan
& Subtract(const wxTimeSpan
& diff
);
1981 Returns the timespan for one week.
1983 static wxTimespan
Week();
1986 Returns the timespan for the given number of weeks.
1988 static wxTimespan
Weeks(long weeks
);
1991 Adds the given wxTimeSpan to this wxTimeSpan and returns the result.
1993 wxTimeSpan
& operator+=(const wxTimeSpan
& diff
);
1996 Multiplies this time span by @a n.
1998 @returns A reference to this wxTimeSpan object modified in place.
2000 wxTimeSpan
& operator*=(int n
);
2003 Negate the value of the timespan.
2007 wxTimeSpan
& operator-();
2010 Subtracts the given wxTimeSpan to this wxTimeSpan and returns the
2013 wxTimeSpan
& operator-=(const wxTimeSpan
& diff
);
2019 @class wxDateTimeHolidayAuthority
2020 @wxheader{datetime.h}
2022 @todo Write wxDateTimeHolidayAuthority documentation.
2027 class wxDateTimeHolidayAuthority