1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of wxDateTime
4 // Author: wxWidgets team
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
12 wxDateTime class represents an absolute moment in the time.
14 The type @c wxDateTime_t is typedefed as <tt>unsigned short</tt> and is
15 used to contain the number of years, hours, minutes, seconds and
19 @section datetime_constants Constants
21 Global constant wxDefaultDateTime and synonym for it wxInvalidDateTime are
22 defined. This constant will be different from any valid wxDateTime object.
24 All the following constants are defined inside wxDateTime class (i.e., to
25 refer to them you should prepend their names with "wxDateTime::").
27 Time zone symbolic names:
32 // the time in the current time zone
35 // zones from GMT (= Greenwhich Mean Time): they're guaranteed to be
36 // consequent numbers, so writing something like `GMT0 + offset' is
37 // safe if abs(offset) <= 12
39 // underscore stands for minus
40 GMT_12, GMT_11, GMT_10, GMT_9, GMT_8, GMT_7,
41 GMT_6, GMT_5, GMT_4, GMT_3, GMT_2, GMT_1,
43 GMT1, GMT2, GMT3, GMT4, GMT5, GMT6,
44 GMT7, GMT8, GMT9, GMT10, GMT11, GMT12, GMT13,
45 // Note that GMT12 and GMT_12 are not the same: there is a difference
46 // of exactly one day between them
48 // some symbolic names for TZ
51 WET = GMT0, // Western Europe Time
52 WEST = GMT1, // Western Europe Summer Time
53 CET = GMT1, // Central Europe Time
54 CEST = GMT2, // Central Europe Summer Time
55 EET = GMT2, // Eastern Europe Time
56 EEST = GMT3, // Eastern Europe Summer Time
57 MSK = GMT3, // Moscow Time
58 MSD = GMT4, // Moscow Summer Time
61 AST = GMT_4, // Atlantic Standard Time
62 ADT = GMT_3, // Atlantic Daylight Time
63 EST = GMT_5, // Eastern Standard Time
64 EDT = GMT_4, // Eastern Daylight Saving Time
65 CST = GMT_6, // Central Standard Time
66 CDT = GMT_5, // Central Daylight Saving Time
67 MST = GMT_7, // Mountain Standard Time
68 MDT = GMT_6, // Mountain Daylight Saving Time
69 PST = GMT_8, // Pacific Standard Time
70 PDT = GMT_7, // Pacific Daylight Saving Time
71 HST = GMT_10, // Hawaiian Standard Time
72 AKST = GMT_9, // Alaska Standard Time
73 AKDT = GMT_8, // Alaska Daylight Saving Time
77 A_WST = GMT8, // Western Standard Time
78 A_CST = GMT13 + 1, // Central Standard Time (+9.5)
79 A_EST = GMT10, // Eastern Standard Time
80 A_ESST = GMT11, // Eastern Summer Time
83 NZST = GMT12, // Standard Time
84 NZDT = GMT13, // Daylight Saving Time
86 // Universal Coordinated Time = the new and politically correct name
92 Month names: Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec and
93 Inv_Month for an invalid month are the values of @c wxDateTime::Month enum.
95 Likewise, Sun, Mon, Tue, Wed, Thu, Fri, Sat, and Inv_WeekDay are the values
96 in @c wxDateTime::WeekDay enum.
98 Finally, Inv_Year is defined to be an invalid value for year parameter.
100 GetMonthName() and GetWeekDayName() functions use the following flags:
105 Name_Full = 0x01, // return full name
106 Name_Abbr = 0x02 // return abbreviated name
110 Several functions accept an extra parameter specifying the calendar to use
111 (although most of them only support now the Gregorian calendar). This
112 parameters is one of the following values:
117 Gregorian, // calendar currently in use in Western countries
118 Julian // calendar in use since -45 until the 1582 (or later)
122 Date calculations often depend on the country and wxDateTime allows to set
123 the country whose conventions should be used using SetCountry(). It takes
124 one of the following values as parameter:
129 Country_Unknown, // no special information for this country
130 Country_Default, // set the default country with SetCountry() method
131 // or use the default country with any other
133 Country_WesternEurope_Start,
134 Country_EEC = Country_WesternEurope_Start,
138 Country_WesternEurope_End = UK,
146 Different parts of the world use different conventions for the week start.
147 In some countries, the week starts on Sunday, while in others -- on Monday.
148 The ISO standard doesn't address this issue, so we support both conventions
149 in the functions whose result depends on it (GetWeekOfYear() and
152 The desired behvaiour may be specified by giving one of the following
153 constants as argument to these functions:
158 Default_First, // Sunday_First for US, Monday_First for the rest
159 Monday_First, // week starts with a Monday
160 Sunday_First // week starts with a Sunday
165 @section datetime_static Static Functions
167 All static functions either set or return the static variables of
168 wxDateSpan (the country), return the current moment, year, month or number
169 of days in it, or do some general calendar-related actions.
171 Please note that although several function accept an extra Calendar
172 parameter, it is currently ignored as only the Gregorian calendar is
173 supported. Future versions will support other calendars.
176 These methods are standalone functions named
177 "wxDateTime_<StaticMethodName>" in wxPython.
181 @section datetime_formatting Date Formatting and Parsing
183 The date formatting and parsing functions convert wxDateTime objects to and
184 from text. The conversions to text are mostly trivial: you can either do it
185 using the default date and time representations for the current locale
186 (FormatDate() and FormatTime()), using the international standard
187 representation defined by ISO 8601 (FormatISODate(), FormatISOTime() and
188 FormatISOCombined()) or by specifying any format at all and using Format()
191 The conversions from text are more interesting, as there are much more
192 possibilities to care about. The simplest cases can be taken care of with
193 ParseFormat() which can parse any date in the given (rigid) format.
194 ParseRfc822Date() is another function for parsing dates in predefined
195 format -- the one of RFC 822 which (still...) defines the format of email
196 messages on the Internet. This format can not be described with
197 @c strptime(3)-like format strings used by Format(), hence the need for a
200 But the most interesting functions are ParseTime(), ParseDate() and
201 ParseDateTime(). They try to parse the date and time (or only one of them)
202 in 'free' format, i.e. allow them to be specified in any of possible ways.
203 These functions will usually be used to parse the (interactive) user input
204 which is not bound to be in any predefined format. As an example,
205 ParseDateTime() can parse the strings such as "tomorrow", "March first" and
208 Finally notice that each of the parsing functions is available in several
209 overloads: if the input string is a narrow (@c char *) string, then a
210 narrow pointer is returned. If the input string is a wide string, a wide
211 char pointer is returned. Finally, if the input parameter is a wxString, a
212 narrow char pointer is also returned for backwards compatibility but there
213 is also an additional argument of wxString::const_iterator type in which,
214 if it is not @NULL, an iterator pointing to the end of the scanned string
222 - ::wxDefaultDateTime
224 @see @ref overview_datetime, wxTimeSpan, wxDateSpan, wxCalendarCtrl
230 @name Constructors, Assignment Operators and Setters
232 Constructors and various Set() methods are collected here. If you
233 construct a date object from separate values for day, month and year,
234 you should use IsValid() method to check that the values were correct
235 as constructors can not return an error code.
240 Default constructor. Use one of the Set() functions to initialize the
248 This constructor is named "wxDateTimeFromTimeT" in wxPython.
251 wxDateTime
& wxDateTime(time_t timet
);
255 @beginWxPythonOnly Unsupported. @endWxPythonOnly
257 wxDateTime
& wxDateTime(const struct tm
& tm
);
262 This constructor is named "wxDateTimeFromJDN" in wxPython.
265 wxDateTime
& wxDateTime(double jdn
);
270 This constructor is named "wxDateTimeFromHMS" in wxPython.
273 wxDateTime
& wxDateTime(wxDateTime_t hour
, wxDateTime_t minute
= 0,
274 wxDateTime_t second
= 0, wxDateTime_t millisec
= 0);
279 This constructor is named "wxDateTimeFromDMY" in wxPython.
282 wxDateTime(wxDateTime_t day
, Month month
= Inv_Month
,
283 int year
= Inv_Year
, wxDateTime_t hour
= 0,
284 wxDateTime_t minute
= 0, wxDateTime_t second
= 0,
285 wxDateTime_t millisec
= 0);
288 Same as SetFromMSWSysTime.
291 Input, Windows SYSTEMTIME reference
295 wxDateTime(const struct _SYSTEMTIME
& st
);
299 Reset time to midnight (00:00:00) without changing the date.
301 wxDateTime
& ResetTime();
304 Constructs the object from @a timet value holding the number of seconds
308 This method is named "SetTimeT" in wxPython.
311 wxDateTime
& Set(time_t timet
);
313 Sets the date and time from the broken down representation in the
314 standard @a tm structure.
316 @beginWxPythonOnly Unsupported. @endWxPythonOnly
318 wxDateTime
& Set(const struct tm
& tm
);
320 Sets the date from the so-called Julian Day Number.
322 By definition, the Julian Day Number, usually abbreviated as JDN, of a
323 particular instant is the fractional number of days since 12 hours
324 Universal Coordinated Time (Greenwich mean noon) on January 1 of the
325 year -4712 in the Julian proleptic calendar.
328 This method is named "SetJDN" in wxPython.
331 wxDateTime
& Set(double jdn
);
333 Sets the date to be equal to Today() and the time from supplied
337 This method is named "SetHMS" in wxPython.
340 wxDateTime
& Set(wxDateTime_t hour
, wxDateTime_t minute
= 0,
341 wxDateTime_t second
= 0, wxDateTime_t millisec
= 0);
343 Sets the date and time from the parameters.
345 wxDateTime
& Set(wxDateTime_t day
, Month month
= Inv_Month
,
346 int year
= Inv_Year
, wxDateTime_t hour
= 0,
347 wxDateTime_t minute
= 0, wxDateTime_t second
= 0,
348 wxDateTime_t millisec
= 0);
351 Sets the day without changing other date components.
353 wxDateTime
& SetDay(short unsigned int);
356 Sets the date from the date and time in DOS format.
358 wxDateTime
& SetFromDOS(unsigned long ddt
);
361 Sets the hour without changing other date components.
363 wxDateTime
& SetHour(short unsigned int);
366 Sets the millisecond without changing other date components.
368 wxDateTime
& SetMillisecond(short unsigned int);
371 Sets the minute without changing other date components.
373 wxDateTime
& SetMinute(short unsigned int);
376 Sets the month without changing other date components.
378 wxDateTime
& SetMonth(Month month
);
381 Sets the second without changing other date components.
383 wxDateTime
& SetSecond(short unsigned int);
386 Sets the date and time of to the current values. Same as assigning the
387 result of Now() to this object.
389 wxDateTime
& SetToCurrent();
392 Sets the year without changing other date components.
394 wxDateTime
& SetYear(int year
);
399 wxDateTime
& operator=(time_t timet
);
403 wxDateTime
& operator=(const struct tm
& tm
);
412 Here are the trivial accessors. Other functions, which might have to
413 perform some more complicated calculations to find the answer are under
414 the "Date Arithmetics" section.
419 Returns the date and time in DOS format.
421 long unsigned int GetAsDOS() const;
424 Initialize using the Windows SYSTEMTIME structure.
426 Input, Windows SYSTEMTIME reference
430 wxDateTime
& SetFromMSWSysTime(const struct _SYSTEMTIME
& st
);
433 Returns the date and time in the Windows SYSTEMTIME format.
435 Output, pointer to Windows SYSTEMTIME
439 void GetAsMSWSysTime(struct _SYSTEMTIME
* st
) const;
442 Returns the century of this date.
444 int GetCentury(const TimeZone
& tz
= Local
) const;
447 Returns the object having the same date component as this one but time
454 wxDateTime
GetDateOnly() const;
457 Returns the day in the given timezone (local one by default).
459 short unsigned int GetDay(const TimeZone
& tz
= Local
) const;
462 Returns the day of the year (in 1-366 range) in the given timezone
463 (local one by default).
465 short unsigned int GetDayOfYear(const TimeZone
& tz
= Local
) const;
468 Returns the hour in the given timezone (local one by default).
470 short unsigned int GetHour(const TimeZone
& tz
= Local
) const;
473 Returns the milliseconds in the given timezone (local one by default).
475 short unsigned int GetMillisecond(const TimeZone
& tz
= Local
) const;
478 Returns the minute in the given timezone (local one by default).
480 short unsigned int GetMinute(const TimeZone
& tz
= Local
) const;
483 Returns the month in the given timezone (local one by default).
485 Month
GetMonth(const TimeZone
& tz
= Local
) const;
488 Returns the seconds in the given timezone (local one by default).
490 short unsigned int GetSecond(const TimeZone
& tz
= Local
) const;
493 Returns the number of seconds since Jan 1, 1970. An assert failure will
494 occur if the date is not in the range covered by @c time_t type.
496 time_t GetTicks() const;
499 Returns broken down representation of the date and time.
501 Tm
GetTm(const TimeZone
& tz
= Local
) const;
504 Returns the week day in the given timezone (local one by default).
506 WeekDay
GetWeekDay(const TimeZone
& tz
= Local
) const;
509 Returns the ordinal number of the week in the month (in 1-5 range).
511 As GetWeekOfYear(), this function supports both conventions for the
512 week start. See the description of these @c WeekFlags in the
513 @ref datetime_constants section.
515 wxDateTime_t
GetWeekOfMonth(WeekFlags flags
= Monday_First
,
516 const TimeZone
& tz
= Local
) const;
519 Returns the number of the week of the year this date is in. The first
520 week of the year is, according to international standards, the one
521 containing Jan 4 or, equivalently, the first week which has Thursday in
522 this year. Both of these definitions are the same as saying that the
523 first week of the year must contain more than half of its days in this
524 year. Accordingly, the week number will always be in 1-53 range (52 for
527 The function depends on the @ref datetime_constants "week start"
528 convention specified by the @a flags argument but its results for
529 @c Sunday_First are not well-defined as the ISO definition quoted above
530 applies to the weeks starting on Monday only.
532 wxDateTime_t
GetWeekOfYear(WeekFlags flags
= Monday_First
,
533 const TimeZone
& tz
= Local
) const;
536 Returns the year in the given timezone (local one by default).
538 int GetYear(const TimeZone
& tz
= Local
) const;
541 Returns @true if the given date is later than the date of adoption of
542 the Gregorian calendar in the given country (and hence the Gregorian
543 calendar calculations make sense for it).
545 bool IsGregorianDate(GregorianAdoption country
= Gr_Standard
) const;
548 Returns @true if the object represents a valid time moment.
550 bool IsValid() const;
553 Returns @true is this day is not a holiday in the given country.
555 bool IsWorkDay(Country country
= Country_Default
) const;
562 @name Date Comparison
564 There are several functions to allow date comparison. To supplement
565 them, a few global operators, etc taking wxDateTime are defined.
570 Returns @true if this date precedes the given one.
572 bool IsEarlierThan(const wxDateTime
& datetime
) const;
575 Returns @true if the two dates are strictly identical.
577 bool IsEqualTo(const wxDateTime
& datetime
) const;
580 Returns @true if the date is equal to another one up to the given time
581 interval, i.e. if the absolute difference between the two dates is less
584 bool IsEqualUpTo(const wxDateTime
& dt
, const wxTimeSpan
& ts
) const;
587 Returns @true if this date is later than the given one.
589 bool IsLaterThan(const wxDateTime
& datetime
) const;
592 Returns @true if the date is the same without comparing the time parts.
594 bool IsSameDate(const wxDateTime
& dt
) const;
597 Returns @true if the time is the same (although dates may differ).
599 bool IsSameTime(const wxDateTime
& dt
) const;
602 Returns @true if this date lies strictly between the two given dates.
606 bool IsStrictlyBetween(const wxDateTime
& t1
,
607 const wxDateTime
& t2
) const;
610 Returns @true if IsStrictlyBetween() is @true or if the date is equal
611 to one of the limit values.
613 @see IsStrictlyBetween()
615 bool IsBetween(const wxDateTime
& t1
, const wxDateTime
& t2
) const;
622 @name Date Arithmetics
624 These functions carry out
625 @ref overview_datetime_arithmetics "arithmetics" on the wxDateTime
626 objects. As explained in the overview, either wxTimeSpan or wxDateSpan
627 may be added to wxDateTime, hence all functions are overloaded to
628 accept both arguments.
630 Also, both Add() and Subtract() have both const and non-const version.
631 The first one returns a new object which represents the sum/difference
632 of the original one with the argument while the second form modifies
633 the object to which it is applied. The operators "-=" and "+=" are
634 defined to be equivalent to the second forms of these functions.
639 Adds the given date span to this object.
642 This method is named "AddDS" in wxPython.
645 wxDateTime
Add(const wxDateSpan
& diff
) const;
647 Adds the given date span to this object.
650 This method is named "AddDS" in wxPython.
653 wxDateTime
Add(const wxDateSpan
& diff
);
655 Adds the given time span to this object.
658 This method is named "AddTS" in wxPython.
661 wxDateTime
Add(const wxTimeSpan
& diff
) const;
663 Adds the given time span to this object.
666 This method is named "AddTS" in wxPython.
669 wxDateTime
& Add(const wxTimeSpan
& diff
);
672 Subtracts the given time span from this object.
675 This method is named "SubtractTS" in wxPython.
678 wxDateTime
Subtract(const wxTimeSpan
& diff
) const;
680 Subtracts the given time span from this object.
683 This method is named "SubtractTS" in wxPython.
686 wxDateTime
& Subtract(const wxTimeSpan
& diff
);
688 Subtracts the given date span from this object.
691 This method is named "SubtractDS" in wxPython.
694 wxDateTime
Subtract(const wxDateSpan
& diff
) const;
696 Subtracts the given date span from this object.
699 This method is named "SubtractDS" in wxPython.
702 wxDateTime
& Subtract(const wxDateSpan
& diff
);
704 Subtracts another date from this one and returns the difference between
705 them as a wxTimeSpan.
707 wxTimeSpan
Subtract(const wxDateTime
& dt
) const;
710 Adds the given date span to this object.
712 wxDateTime
operator+=(const wxDateSpan
& diff
);
714 Subtracts the given date span from this object.
716 wxDateTime
& operator-=(const wxDateSpan
& diff
);
718 Adds the given time span to this object.
720 wxDateTime
& operator+=(const wxTimeSpan
& diff
);
722 Subtracts the given time span from this object.
724 wxDateTime
& operator-=(const wxTimeSpan
& diff
);
731 @name Date Formatting and Parsing
733 See @ref datetime_formatting
738 This function does the same as the standard ANSI C @c strftime(3)
739 function. Please see its description for the meaning of @a format
742 It also accepts a few wxWidgets-specific extensions: you can optionally
743 specify the width of the field to follow using @c printf(3)-like syntax
744 and the format specification @c "%l" can be used to get the number of
749 wxString
Format(const wxChar
* format
= wxDefaultDateTimeFormat
,
750 const TimeZone
& tz
= Local
) const;
753 Identical to calling Format() with @c "%x" argument (which means
754 "preferred date representation for the current locale").
756 wxString
FormatDate() const;
759 Returns the combined date-time representation in the ISO 8601 format
760 @c "YYYY-MM-DDTHH:MM:SS". The @a sep parameter default value produces
761 the result exactly corresponding to the ISO standard, but it can also
762 be useful to use a space as seprator if a more human-readable combined
763 date-time representation is needed.
765 @see FormatISODate(), FormatISOTime(), ParseISOCombined()
767 wxString
FormatISOCombined(char sep
= 'T') const;
770 This function returns the date representation in the ISO 8601 format
773 wxString
FormatISODate() const;
776 This function returns the time representation in the ISO 8601 format
779 wxString
FormatISOTime() const;
782 Identical to calling Format() with @c "%X" argument (which means
783 "preferred time representation for the current locale").
785 wxString
FormatTime() const;
788 This function is like ParseDateTime(), but it only allows the date to
789 be specified. It is thus less flexible then ParseDateTime(), but also
790 has less chances to misinterpret the user input.
792 @return @NULL if the conversion failed, otherwise return the pointer
793 to the character which stopped the scan.
795 const char* ParseDate(const wxString
& date
,
796 wxString::const_iterator
* end
= NULL
);
798 This function is like ParseDateTime(), but it only allows the date to
799 be specified. It is thus less flexible then ParseDateTime(), but also
800 has less chances to misinterpret the user input.
802 @return @NULL if the conversion failed, otherwise return the pointer
803 to the character which stopped the scan.
805 const char* ParseDate(const char* date
);
807 This function is like ParseDateTime(), but it only allows the date to
808 be specified. It is thus less flexible then ParseDateTime(), but also
809 has less chances to misinterpret the user input.
811 @return @NULL if the conversion failed, otherwise return the pointer
812 to the character which stopped the scan.
814 const wchar_t* ParseDate(const wchar_t* date
);
817 Parses the string @a datetime containing the date and time in free
818 format. This function tries as hard as it can to interpret the given
819 string as date and time. Unlike ParseRfc822Date(), it will accept
820 anything that may be accepted and will only reject strings which can
821 not be parsed in any way at all.
823 @return @NULL if the conversion failed, otherwise return the pointer
824 to the character which stopped the scan.
826 const char* ParseDateTime(const wxString
& datetime
,
827 wxString::const_iterator
* end
= NULL
);
829 Parses the string @a datetime containing the date and time in free
830 format. This function tries as hard as it can to interpret the given
831 string as date and time. Unlike ParseRfc822Date(), it will accept
832 anything that may be accepted and will only reject strings which can
833 not be parsed in any way at all.
835 @return @NULL if the conversion failed, otherwise return the pointer
836 to the character which stopped the scan.
838 const char* ParseDateTime(const char* datetime
);
840 Parses the string @a datetime containing the date and time in free
841 format. This function tries as hard as it can to interpret the given
842 string as date and time. Unlike ParseRfc822Date(), it will accept
843 anything that may be accepted and will only reject strings which can
844 not be parsed in any way at all.
846 @return @NULL if the conversion failed, otherwise return the pointer
847 to the character which stopped the scan.
849 const wchar_t* ParseDateTime(const wchar_t* datetime
);
852 This function parses the string @a date according to the given
853 @e format. The system @c strptime(3) function is used whenever
854 available, but even if it is not, this function is still implemented,
855 although support for locale-dependent format specifiers such as
856 @c "%c", @c "%x" or @c "%X" may not be perfect and GNU extensions such
857 as @c "%z" and @c "%Z" are not implemented. This function does handle
858 the month and weekday names in the current locale on all platforms,
861 Please see the description of the ANSI C function @c strftime(3) for
862 the syntax of the format string.
864 The @a dateDef parameter is used to fill in the fields which could not
865 be determined from the format string. For example, if the format is
866 @c "%d" (the day of the month), the month and the year are taken from
867 @a dateDef. If it is not specified, Today() is used as the default
870 @return @NULL if the conversion failed, otherwise return the pointer
871 to the character which stopped the scan.
873 const char* ParseFormat(const wxString
& date
,
874 const wxString
& format
= wxDefaultDateTimeFormat
,
875 const wxDateTime
& dateDef
= wxDefaultDateTime
,
876 wxString::const_iterator
* end
= NULL
);
878 This function parses the string @a date according to the given
879 @e format. The system @c strptime(3) function is used whenever
880 available, but even if it is not, this function is still implemented,
881 although support for locale-dependent format specifiers such as
882 @c "%c", @c "%x" or @c "%X" may not be perfect and GNU extensions such
883 as @c "%z" and @c "%Z" are not implemented. This function does handle
884 the month and weekday names in the current locale on all platforms,
887 Please see the description of the ANSI C function @c strftime(3) for
888 the syntax of the format string.
890 The @a dateDef parameter is used to fill in the fields which could not
891 be determined from the format string. For example, if the format is
892 @c "%d" (the day of the month), the month and the year are taken from
893 @a dateDef. If it is not specified, Today() is used as the default
896 @return @NULL if the conversion failed, otherwise return the pointer
897 to the character which stopped the scan.
899 const char* ParseFormat(const char* date
,
900 const wxString
& format
= wxDefaultDateTimeFormat
,
901 const wxDateTime
& dateDef
= wxDefaultDateTime
);
903 This function parses the string @a date according to the given
904 @e format. The system @c strptime(3) function is used whenever
905 available, but even if it is not, this function is still implemented,
906 although support for locale-dependent format specifiers such as
907 @c "%c", @c "%x" or @c "%X" may not be perfect and GNU extensions such
908 as @c "%z" and @c "%Z" are not implemented. This function does handle
909 the month and weekday names in the current locale on all platforms,
912 Please see the description of the ANSI C function @c strftime(3) for
913 the syntax of the format string.
915 The @a dateDef parameter is used to fill in the fields which could not
916 be determined from the format string. For example, if the format is
917 @c "%d" (the day of the month), the month and the year are taken from
918 @a dateDef. If it is not specified, Today() is used as the default
921 @return @NULL if the conversion failed, otherwise return the pointer
922 to the character which stopped the scan.
924 const wchar_t* ParseFormat(const wchar_t* date
,
925 const wxString
& format
= wxDefaultDateTimeFormat
,
926 const wxDateTime
& dateDef
= wxDefaultDateTime
);
929 This function parses the string containing the date and time in ISO
930 8601 combined format @c "YYYY-MM-DDTHH:MM:SS". The separator between
931 the date and time parts must be equal to @a sep for the function to
934 @return @true if the entire string was parsed successfully, @false
937 bool ParseISOCombined(const wxString
& date
, char sep
= 'T');
940 This function parses the date in ISO 8601 format @c "YYYY-MM-DD".
942 @return @true if the entire string was parsed successfully, @false
945 bool ParseISODate(const wxString
& date
);
948 This function parses the time in ISO 8601 format @c "HH:MM:SS".
950 @return @true if the entire string was parsed successfully, @false
953 bool ParseISOTime(const wxString
& date
);
956 Parses the string @a date looking for a date formatted according to the
957 RFC 822 in it. The exact description of this format may, of course, be
958 found in the RFC (section 5), but, briefly, this is the format used in
959 the headers of Internet email messages and one of the most common
960 strings expressing date in this format may be something like
961 @c "Sat, 18 Dec 1999 00:48:30 +0100".
963 Returns @NULL if the conversion failed, otherwise return the pointer to
964 the character immediately following the part of the string which could
965 be parsed. If the entire string contains only the date in RFC 822
966 format, the returned pointer will be pointing to a @c NUL character.
968 This function is intentionally strict, it will return an error for any
969 string which is not RFC 822 compliant. If you need to parse date
970 formatted in more free ways, you should use ParseDateTime() or
973 const char* ParseRfc822Date(const wxString
& date
,
974 wxString::const_iterator
* end
= NULL
);
976 Parses the string @a date looking for a date formatted according to the
977 RFC 822 in it. The exact description of this format may, of course, be
978 found in the RFC (section 5), but, briefly, this is the format used in
979 the headers of Internet email messages and one of the most common
980 strings expressing date in this format may be something like
981 @c "Sat, 18 Dec 1999 00:48:30 +0100".
983 Returns @NULL if the conversion failed, otherwise return the pointer to
984 the character immediately following the part of the string which could
985 be parsed. If the entire string contains only the date in RFC 822
986 format, the returned pointer will be pointing to a @c NUL character.
988 This function is intentionally strict, it will return an error for any
989 string which is not RFC 822 compliant. If you need to parse date
990 formatted in more free ways, you should use ParseDateTime() or
993 const char* ParseRfc822Date(const char* date
);
995 Parses the string @a date looking for a date formatted according to the
996 RFC 822 in it. The exact description of this format may, of course, be
997 found in the RFC (section 5), but, briefly, this is the format used in
998 the headers of Internet email messages and one of the most common
999 strings expressing date in this format may be something like
1000 @c "Sat, 18 Dec 1999 00:48:30 +0100".
1002 Returns @NULL if the conversion failed, otherwise return the pointer to
1003 the character immediately following the part of the string which could
1004 be parsed. If the entire string contains only the date in RFC 822
1005 format, the returned pointer will be pointing to a @c NUL character.
1007 This function is intentionally strict, it will return an error for any
1008 string which is not RFC 822 compliant. If you need to parse date
1009 formatted in more free ways, you should use ParseDateTime() or
1010 ParseDate() instead.
1012 const wchar_t* ParseRfc822Date(const wchar_t* date
);
1015 This functions is like ParseDateTime(), but only allows the time to be
1016 specified in the input string.
1018 @return @NULL if the conversion failed, otherwise return the pointer
1019 to the character which stopped the scan.
1021 const char* ParseTime(const wxString
& time
,
1022 wxString::const_iterator
* end
= NULL
);
1024 This functions is like ParseDateTime(), but only allows the time to be
1025 specified in the input string.
1027 @return @NULL if the conversion failed, otherwise return the pointer
1028 to the character which stopped the scan.
1030 const char* ParseTime(const char* time
);
1032 This functions is like ParseDateTime(), but only allows the time to be
1033 specified in the input string.
1035 @return @NULL if the conversion failed, otherwise return the pointer
1036 to the character which stopped the scan.
1038 const wchar_t* ParseTime(const wchar_t* time
);
1045 @name Calendar Calculations
1047 The functions in this section perform the basic calendar calculations,
1048 mostly related to the week days. They allow to find the given week day
1049 in the week with given number (either in the month or in the year) and
1052 None of the functions in this section modify the time part of the
1053 wxDateTime, they only work with the date part of it.
1058 Returns the copy of this object to which SetToLastMonthDay() was
1061 wxDateTime
GetLastMonthDay(Month month
= Inv_Month
,
1062 int year
= Inv_Year
) const;
1065 Returns the copy of this object to which SetToLastWeekDay() was
1068 wxDateTime
GetLastWeekDay(WeekDay weekday
, Month month
= Inv_Month
,
1069 int year
= Inv_Year
);
1072 Returns the copy of this object to which SetToNextWeekDay() was
1075 wxDateTime
GetNextWeekDay(WeekDay weekday
) const;
1078 Returns the copy of this object to which SetToPrevWeekDay() was
1081 wxDateTime
GetPrevWeekDay(WeekDay weekday
) const;
1084 Returns the copy of this object to which SetToWeekDay() was applied.
1086 wxDateTime
GetWeekDay(WeekDay weekday
, int n
= 1, Month month
= Inv_Month
,
1087 int year
= Inv_Year
) const;
1090 Returns the copy of this object to which SetToWeekDayInSameWeek() was
1093 wxDateTime
GetWeekDayInSameWeek(WeekDay weekday
,
1094 WeekFlags flags
= Monday_First
) const;
1097 Returns the copy of this object to which SetToYearDay() was applied.
1099 wxDateTime
GetYearDay(wxDateTime_t yday
) const;
1102 Sets the date to the last day in the specified month (the current one
1105 @return The reference to the modified object itself.
1107 wxDateTime
SetToLastMonthDay(Month month
= Inv_Month
,
1108 int year
= Inv_Year
);
1111 The effect of calling this function is the same as of calling
1112 @c SetToWeekDay(-1, weekday, month, year). The date will be set to the
1113 last @a weekday in the given month and year (the current ones by
1114 default). Always returns @true.
1116 bool SetToLastWeekDay(WeekDay weekday
, Month month
= Inv_Month
,
1117 int year
= Inv_Year
);
1120 Sets the date so that it will be the first @a weekday following the
1123 @return The reference to the modified object itself.
1125 wxDateTime
& SetToNextWeekDay(WeekDay weekday
);
1128 Sets the date so that it will be the last @a weekday before the current
1131 @return The reference to the modified object itself.
1133 wxDateTime
& SetToPrevWeekDay(WeekDay weekday
);
1136 Sets the date to the @e n-th @a weekday in the given month of the given
1137 year (the current month and year are used by default). The parameter
1138 @a n may be either positive (counting from the beginning of the month)
1139 or negative (counting from the end of it).
1141 For example, SetToWeekDay(2, wxDateTime::Wed) will set the date to the
1142 second Wednesday in the current month and
1143 SetToWeekDay(-1, wxDateTime::Sun) will set the date to the last Sunday
1144 in the current month.
1146 @return @true if the date was modified successfully, @false otherwise
1147 meaning that the specified date doesn't exist.
1149 bool SetToWeekDay(WeekDay weekday
, int n
= 1,
1150 Month month
= Inv_Month
, int year
= Inv_Year
);
1153 Adjusts the date so that it will still lie in the same week as before,
1154 but its week day will be the given one.
1156 @return The reference to the modified object itself.
1158 wxDateTime
SetToWeekDayInSameWeek(WeekDay weekday
,
1159 WeekFlags flags
= Monday_First
);
1162 Sets the date to the day number @a yday in the same year (i.e., unlike
1163 the other functions, this one does not use the current year). The day
1164 number should be in the range 1-366 for the leap years and 1-365 for
1167 @return The reference to the modified object itself.
1169 wxDateTime
& SetToYearDay(wxDateTime_t yday
);
1176 @name Astronomical/Historical Functions
1178 Some degree of support for the date units used in astronomy and/or
1179 history is provided. You can construct a wxDateTime object from a
1180 JDN and you may also get its JDN, MJD or Rata Die number from it.
1182 Related functions in other groups: wxDateTime(double), Set(double)
1187 Synonym for GetJulianDayNumber().
1189 double GetJDN() const;
1192 Returns the JDN corresponding to this date. Beware of rounding errors!
1194 @see GetModifiedJulianDayNumber()
1196 double GetJulianDayNumber() const;
1199 Synonym for GetModifiedJulianDayNumber().
1201 double GetMJD() const;
1204 Returns the @e "Modified Julian Day Number" (MJD) which is, by
1205 definition, is equal to JDN - 2400000.5.
1206 The MJDs are simpler to work with as the integral MJDs correspond to
1207 midnights of the dates in the Gregorian calendar and not the noons like
1208 JDN. The MJD 0 represents Nov 17, 1858.
1210 double GetModifiedJulianDayNumber() const;
1213 Return the @e Rata Die number of this date.
1215 By definition, the Rata Die number is a date specified as the number of
1216 days relative to a base date of December 31 of the year 0. Thus January
1217 1 of the year 1 is Rata Die day 1.
1219 double GetRataDie() const;
1226 @name Time Zone and DST Support
1228 Please see the @ref overview_datetime_timezones "time zone overview"
1229 for more information about time zones. Normally, these functions should
1232 Related functions in other groups: GetBeginDST(), GetEndDST()
1237 Transform the date from the given time zone to the local one. If
1238 @a noDST is @true, no DST adjustments will be made.
1240 @return The date in the local time zone.
1242 wxDateTime
FromTimezone(const TimeZone
& tz
, bool noDST
= false) const;
1245 Returns @true if the DST is applied for this date in the given country.
1247 @see GetBeginDST(), GetEndDST()
1249 int IsDST(Country country
= Country_Default
) const;
1252 Same as FromTimezone() but modifies the object in place.
1254 wxDateTime
MakeFromTimezone(const TimeZone
& tz
, bool noDST
= false);
1257 Modifies the object in place to represent the date in another time
1258 zone. If @a noDST is @true, no DST adjustments will be made.
1260 wxDateTime
MakeTimezone(const TimeZone
& tz
, bool noDST
= false);
1263 This is the same as calling MakeTimezone() with the argument @c GMT0.
1265 wxDateTime
& MakeUTC(bool noDST
= false);
1268 Transform the date to the given time zone. If @a noDST is @true, no DST
1269 adjustments will be made.
1271 @return The date in the new time zone.
1273 wxDateTime
ToTimezone(const TimeZone
& tz
, bool noDST
= false) const;
1276 This is the same as calling ToTimezone() with the argument @c GMT0.
1278 wxDateTime
ToUTC(bool noDST
= false) const;
1287 Converts the year in absolute notation (i.e. a number which can be
1288 negative, positive or zero) to the year in BC/AD notation. For the
1289 positive years, nothing is done, but the year 0 is year 1 BC and so for
1290 other years there is a difference of 1.
1292 This function should be used like this:
1296 int y = dt.GetYear();
1297 printf("The year is %d%s", wxDateTime::ConvertYearToBC(y), y > 0 ? "AD" : "BC");
1300 static int ConvertYearToBC(int year
);
1303 Returns the translations of the strings @c AM and @c PM used for time
1304 formatting for the current locale. Either of the pointers may be @NULL
1305 if the corresponding value is not needed.
1307 static void GetAmPmStrings(wxString
* am
, wxString
* pm
);
1310 Get the beginning of DST for the given country in the given year
1311 (current one by default). This function suffers from limitations
1312 described in the @ref overview_datetime_dst "DST overview".
1316 static wxDateTime
GetBeginDST(int year
= Inv_Year
,
1317 Country country
= Country_Default
);
1320 Returns the end of DST for the given country in the given year (current
1325 static wxDateTime
GetEndDST(int year
= Inv_Year
,
1326 Country country
= Country_Default
);
1329 Get the current century, i.e. first two digits of the year, in given
1330 calendar (only Gregorian is currently supported).
1332 static int GetCentury(int year
);
1335 Returns the current default country. The default country is used for
1336 DST calculations, for example.
1340 static Country
GetCountry();
1343 Get the current month in given calendar (only Gregorian is currently
1346 static Month
GetCurrentMonth(Calendar cal
= Gregorian
);
1349 Get the current year in given calendar (only Gregorian is currently
1352 static int GetCurrentYear(Calendar cal
= Gregorian
);
1355 Gets the full (default) or abbreviated (specify @c Name_Abbr name of
1358 @see GetWeekDayName()
1360 static wxString
GetMonthName(Month month
, NameFlags flags
= Name_Full
);
1363 Returns the number of days in the given year. The only supported value
1364 for @a cal currently is @c Gregorian.
1367 This method is named "GetNumberOfDaysInYear" in wxPython.
1370 static wxDateTime_t
GetNumberOfDays(int year
, Calendar cal
= Gregorian
);
1373 Returns the number of days in the given month of the given year. The
1374 only supported value for @a cal currently is @c Gregorian.
1377 This method is named "GetNumberOfDaysInMonth" in wxPython.
1380 static wxDateTime_t
GetNumberOfDays(Month month
, int year
= Inv_Year
,
1381 Calendar cal
= Gregorian
);
1384 Returns the current time.
1386 static time_t GetTimeNow();
1389 Returns the current time broken down using the buffer whose adress is
1390 passed to the function with @a tm to store the result.
1392 static struct tm
* GetTmNow(struct tm
*tm
);
1395 Returns the current time broken down. Note that this function returns a
1396 pointer to a static buffer that's reused by calls to this function and
1397 certain C library functions (e.g. localtime). If there is any chance
1398 your code might be used in a multi-threaded application, you really
1399 should use GetTmNow(struct tm *) instead.
1401 static struct tm
* GetTmNow();
1404 Gets the full (default) or abbreviated (specify @c Name_Abbr) name of
1409 static wxString
GetWeekDayName(WeekDay weekday
,
1410 NameFlags flags
= Name_Full
);
1413 Returns @true if DST was used in the given year (the current one by
1414 default) in the given country.
1416 static bool IsDSTApplicable(int year
= Inv_Year
,
1417 Country country
= Country_Default
);
1420 Returns @true if the @a year is a leap one in the specified calendar.
1421 This functions supports Gregorian and Julian calendars.
1423 static bool IsLeapYear(int year
= Inv_Year
, Calendar cal
= Gregorian
);
1426 This function returns @true if the specified (or default) country is
1427 one of Western European ones. It is used internally by wxDateTime to
1428 determine the DST convention and date and time formatting rules.
1430 static bool IsWestEuropeanCountry(Country country
= Country_Default
);
1433 Returns the object corresponding to the current time.
1438 wxDateTime now = wxDateTime::Now();
1439 printf("Current time in Paris:\t%s\n", now.Format("%c", wxDateTime::CET).c_str());
1442 @note This function is accurate up to seconds. UNow() should be used
1443 for better precision, but it is less efficient and might not be
1444 available on all platforms.
1448 static wxDateTime
Now();
1451 Sets the country to use by default. This setting influences the DST
1452 calculations, date formatting and other things.
1454 The possible values for @a country parameter are enumerated in the
1455 @ref datetime_constants section.
1459 static void SetCountry(Country country
);
1462 Set the date to the given @a weekday in the week number @a numWeek of
1463 the given @a year . The number should be in range 1-53.
1465 Note that the returned date may be in a different year than the one
1466 passed to this function because both the week 1 and week 52 or 53 (for
1467 leap years) contain days from different years. See GetWeekOfYear() for
1468 the explanation of how the year weeks are counted.
1470 static wxDateTime
SetToWeekOfYear(int year
, wxDateTime_t numWeek
,
1471 WeekDay weekday
= Mon
);
1474 Returns the object corresponding to the midnight of the current day
1475 (i.e. the same as Now(), but the time part is set to 0).
1479 static wxDateTime
Today();
1482 Returns the object corresponding to the current time including the
1483 milliseconds if a function to get time with such precision is available
1484 on the current platform (supported under most Unices and Win32).
1488 static wxDateTime
UNow();
1492 Global instance of an empty wxDateTime object.
1494 @todo Would it be better to rename this wxNullDateTime so it's consistent
1495 with the rest of the "empty/invalid/null" global objects?
1497 const wxDateTime wxDefaultDateTime
;
1502 @class wxDateTimeWorkDays
1504 @todo Write wxDateTimeWorkDays documentation.
1509 class wxDateTimeWorkDays
1520 This class is a "logical time span" and is useful for implementing program
1521 logic for such things as "add one month to the date" which, in general,
1522 doesn't mean to add 60*60*24*31 seconds to it, but to take the same date
1523 the next month (to understand that this is indeed different consider adding
1524 one month to Feb, 15 -- we want to get Mar, 15, of course).
1526 When adding a month to the date, all lesser components (days, hours, ...)
1527 won't be changed unless the resulting date would be invalid: for example,
1528 Jan 31 + 1 month will be Feb 28, not (non-existing) Feb 31.
1530 Because of this feature, adding and subtracting back again the same
1531 wxDateSpan will @b not, in general, give back the original date: Feb 28 - 1
1532 month will be Jan 28, not Jan 31!
1534 wxDateSpan objects can be either positive or negative. They may be
1535 multiplied by scalars which multiply all deltas by the scalar: i.e.
1536 2*(1 month and 1 day) is 2 months and 2 days. They can be added together
1537 with wxDateTime or wxTimeSpan, but the type of result is different for each
1540 @warning If you specify both weeks and days, the total number of days added
1541 will be 7*weeks + days! See also GetTotalDays().
1543 Equality operators are defined for wxDateSpans. Two wxDateSpans are equal
1544 if and only if they both give the same target date when added to @b every
1545 source date. Thus wxDateSpan::Months(1) is not equal to
1546 wxDateSpan::Days(30), because they don't give the same date when added to
1547 Feb 1st. But wxDateSpan::Days(14) is equal to wxDateSpan::Weeks(2).
1549 Finally, notice that for adding hours, minutes and so on you don't need
1550 this class at all: wxTimeSpan will do the job because there are no
1551 subtleties associated with those (we don't support leap seconds).
1556 @see @ref overview_datetime, wxDateTime
1562 Constructs the date span object for the given number of years, months,
1563 weeks and days. Note that the weeks and days add together if both are
1566 wxDateSpan(int years
= 0, int months
= 0, int weeks
= 0, int days
= 0);
1569 Returns the sum of two date spans.
1571 @return A new wxDateSpan object with the result.
1573 wxDateSpan
Add(const wxDateSpan
& other
) const;
1575 Adds the given wxDateSpan to this wxDateSpan and returns a reference
1578 wxDateSpan
& Add(const wxDateSpan
& other
);
1581 Returns a date span object corresponding to one day.
1585 static wxDateSpan
Day();
1588 Returns a date span object corresponding to the given number of days.
1592 static wxDateSpan
Days(int days
);
1595 Returns the number of days (not counting the weeks component) in this
1600 int GetDays() const;
1603 Returns the number of the months (not counting the years) in this date
1606 int GetMonths() const;
1609 Returns the combined number of days in this date span, counting both
1610 weeks and days. This doesn't take months or years into account.
1612 @see GetWeeks(), GetDays()
1614 int GetTotalDays() const;
1617 Returns the number of weeks in this date span.
1621 int GetWeeks() const;
1624 Returns the number of years in this date span.
1626 int GetYears() const;
1629 Returns a date span object corresponding to one month.
1633 static wxDateSpan
Month();
1636 Returns a date span object corresponding to the given number of months.
1640 static wxDateSpan
Months(int mon
);
1643 Returns the product of the date span by the specified @a factor. The
1644 product is computed by multiplying each of the components by the
1647 @return A new wxDateSpan object with the result.
1649 wxDateSpan
Multiply(int factor
) const;
1651 Multiplies this date span by the specified @a factor. The product is
1652 computed by multiplying each of the components by the @a factor.
1654 @return A reference to this wxDateSpan object modified in place.
1656 wxDateSpan
& Multiply(int factor
);
1659 Changes the sign of this date span.
1666 Returns a date span with the opposite sign.
1670 wxDateSpan
Negate() const;
1673 Sets the number of days (without modifying any other components) in
1676 wxDateSpan
& SetDays(int n
);
1679 Sets the number of months (without modifying any other components) in
1682 wxDateSpan
& SetMonths(int n
);
1685 Sets the number of weeks (without modifying any other components) in
1688 wxDateSpan
& SetWeeks(int n
);
1691 Sets the number of years (without modifying any other components) in
1694 wxDateSpan
& SetYears(int n
);
1697 Returns the difference of two date spans.
1699 @return A new wxDateSpan object with the result.
1701 wxDateSpan
Subtract(const wxDateSpan
& other
) const;
1703 Subtracts the given wxDateSpan to this wxDateSpan and returns a
1704 reference to itself.
1706 wxDateSpan
& Subtract(const wxDateSpan
& other
);
1709 Returns a date span object corresponding to one week.
1713 static wxDateSpan
Week();
1716 Returns a date span object corresponding to the given number of weeks.
1720 static wxDateSpan
Weeks(int weeks
);
1723 Returns a date span object corresponding to one year.
1727 static wxDateSpan
Year();
1730 Returns a date span object corresponding to the given number of years.
1734 static wxDateSpan
Years(int years
);
1737 Adds the given wxDateSpan to this wxDateSpan and returns the result.
1739 wxDateSpan
& operator+=(const wxDateSpan
& other
);
1742 Subtracts the given wxDateSpan to this wxDateSpan and returns the
1745 wxDateSpan
& operator-=(const wxDateSpan
& other
);
1748 Changes the sign of this date span.
1752 wxDateSpan
& operator-();
1755 Multiplies this date span by the specified @a factor. The product is
1756 computed by multiplying each of the components by the @a factor.
1758 @return A reference to this wxDateSpan object modified in place.
1760 wxDateSpan
& operator*=(int factor
);
1763 Returns @true if this date span is different from the other one.
1765 bool operator!=(const wxDateSpan
&) const;
1768 Returns @true if this date span is equal to the other one. Two date
1769 spans are considered equal if and only if they have the same number of
1770 years and months and the same total number of days (counting both days
1773 bool operator==(const wxDateSpan
&) const;
1781 wxTimeSpan class represents a time interval.
1786 @see @ref overview_datetime, wxDateTime
1792 Default constructor, constructs a zero timespan.
1796 Constructs timespan from separate values for each component, with the
1797 date set to 0. Hours are not restricted to 0-24 range, neither are
1798 minutes, seconds or milliseconds.
1800 wxTimeSpan(long hours
, long min
= 0, wxLongLong sec
= 0, wxLongLong msec
= 0);
1803 Returns the absolute value of the timespan: does not modify the object.
1805 wxTimeSpan
Abs() const;
1808 Returns the sum of two time spans.
1810 @return A new wxDateSpan object with the result.
1812 wxTimeSpan
Add(const wxTimeSpan
& diff
) const;
1814 Adds the given wxTimeSpan to this wxTimeSpan and returns a reference
1817 wxTimeSpan
& Add(const wxTimeSpan
& diff
);
1820 Returns the timespan for one day.
1822 static wxTimespan
Day();
1825 Returns the timespan for the given number of days.
1827 static wxTimespan
Days(long days
);
1830 Returns the string containing the formatted representation of the time
1831 span. The following format specifiers are allowed after %:
1833 - @c H - Number of Hours
1834 - @c M - Number of Minutes
1835 - @c S - Number of Seconds
1836 - @c l - Number of Milliseconds
1837 - @c D - Number of Days
1838 - @c E - Number of Weeks
1839 - @c % - The percent character
1841 Note that, for example, the number of hours in the description above is
1842 not well defined: it can be either the total number of hours (for
1843 example, for a time span of 50 hours this would be 50) or just the hour
1844 part of the time span, which would be 2 in this case as 50 hours is
1845 equal to 2 days and 2 hours.
1847 wxTimeSpan resolves this ambiguity in the following way: if there had
1848 been, indeed, the @c %D format specified preceding the @c %H, then it
1849 is interpreted as 2. Otherwise, it is 50.
1851 The same applies to all other format specifiers: if they follow a
1852 specifier of larger unit, only the rest part is taken, otherwise the
1855 wxString
Format(const wxString
& = wxDefaultTimeSpanFormat
) const;
1858 Returns the difference in number of days.
1860 int GetDays() const;
1863 Returns the difference in number of hours.
1865 int GetHours() const;
1868 Returns the difference in number of milliseconds.
1870 wxLongLong
GetMilliseconds() const;
1873 Returns the difference in number of minutes.
1875 int GetMinutes() const;
1878 Returns the difference in number of seconds.
1880 wxLongLong
GetSeconds() const;
1883 Returns the internal representation of timespan.
1885 wxLongLong
GetValue() const;
1888 Returns the difference in number of weeks.
1890 int GetWeeks() const;
1893 Returns the timespan for one hour.
1895 static wxTimespan
Hour();
1898 Returns the timespan for the given number of hours.
1900 static wxTimespan
Hours(long hours
);
1903 Returns @true if two timespans are equal.
1905 bool IsEqualTo(const wxTimeSpan
& ts
) const;
1908 Compares two timespans: works with the absolute values, i.e. -2 hours
1909 is longer than 1 hour. Also, it will return @false if the timespans are
1910 equal in absolute value.
1912 bool IsLongerThan(const wxTimeSpan
& ts
) const;
1915 Returns @true if the timespan is negative.
1917 bool IsNegative() const;
1920 Returns @true if the timespan is empty.
1922 bool IsNull() const;
1925 Returns @true if the timespan is positive.
1927 bool IsPositive() const;
1930 Compares two timespans: works with the absolute values, i.e. 1 hour is
1931 shorter than -2 hours. Also, it will return @false if the timespans are
1932 equal in absolute value.
1934 bool IsShorterThan(const wxTimeSpan
& ts
) const;
1937 Returns the timespan for one millisecond.
1939 static wxTimespan
Millisecond();
1942 Returns the timespan for the given number of milliseconds.
1944 static wxTimespan
Milliseconds(long ms
);
1947 Returns the timespan for one minute.
1949 static wxTimespan
Minute();
1952 Returns the timespan for the given number of minutes.
1954 static wxTimespan
Minutes(long min
);
1957 Returns the product of this time span by @a n.
1959 @return A new wxTimeSpan object with the result.
1961 wxTimeSpan
Multiply(int n
) const;
1963 Multiplies this time span by @a n.
1965 @return A reference to this wxTimeSpan object modified in place.
1967 wxTimeSpan
& Multiply(int n
);
1970 Negate the value of the timespan.
1977 Returns timespan with inverted sign.
1981 wxTimeSpan
Negate() const;
1984 Returns the timespan for one second.
1986 static wxTimespan
Second();
1989 Returns the timespan for the given number of seconds.
1991 static wxTimespan
Seconds(long sec
);
1994 Returns the difference of two time spans.
1996 @return A new wxDateSpan object with the result.
1998 wxTimeSpan
Subtract(const wxTimeSpan
& diff
) const;
2000 Subtracts the given wxTimeSpan to this wxTimeSpan and returns a
2001 reference to itself.
2003 wxTimeSpan
& Subtract(const wxTimeSpan
& diff
);
2006 Returns the timespan for one week.
2008 static wxTimespan
Week();
2011 Returns the timespan for the given number of weeks.
2013 static wxTimespan
Weeks(long weeks
);
2016 Adds the given wxTimeSpan to this wxTimeSpan and returns the result.
2018 wxTimeSpan
& operator+=(const wxTimeSpan
& diff
);
2021 Multiplies this time span by @a n.
2023 @return A reference to this wxTimeSpan object modified in place.
2025 wxTimeSpan
& operator*=(int n
);
2028 Negate the value of the timespan.
2032 wxTimeSpan
& operator-();
2035 Subtracts the given wxTimeSpan to this wxTimeSpan and returns the
2038 wxTimeSpan
& operator-=(const wxTimeSpan
& diff
);
2044 @class wxDateTimeHolidayAuthority
2046 @todo Write wxDateTimeHolidayAuthority documentation.
2051 class wxDateTimeHolidayAuthority