1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: declarations of time/date related classes (wxDateTime,
5 // Author: Vadim Zeitlin
9 // Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
10 // Licence: wxWindows licence
11 /////////////////////////////////////////////////////////////////////////////
13 #ifndef _WX_DATETIME_H
14 #define _WX_DATETIME_H
23 #include "wx/msw/wince/time.h"
26 #include <limits.h> // for INT_MIN
28 #include "wx/longlong.h"
30 class WXDLLIMPEXP_BASE wxDateTime
;
31 class WXDLLIMPEXP_BASE wxTimeSpan
;
32 class WXDLLIMPEXP_BASE wxDateSpan
;
34 #include "wx/dynarray.h"
36 // not all c-runtimes are based on 1/1/1970 being (time_t) 0
37 // set this to the corresponding value in seconds 1/1/1970 has on your
40 #if defined(__WXMAC__) && !defined(__DARWIN__) && __MSL__ < 0x6000
41 #define WX_TIME_BASE_OFFSET ( 2082844800L + 126144000L )
43 #define WX_TIME_BASE_OFFSET 0
48 * + 1. Time zones with minutes (make TimeZone a class)
49 * ? 2. getdate() function like under Solaris
50 * + 3. text conversion for wxDateSpan
51 * + 4. pluggable modules for the workdays calculations
52 * 5. wxDateTimeHolidayAuthority for Easter and other christian feasts
55 /* Two wrapper functions for thread safety */
56 #ifdef HAVE_LOCALTIME_R
57 #define wxLocaltime_r localtime_r
59 struct tm
*wxLocaltime_r(const time_t*, struct tm
*)
60 #warning using pseudo thread-safe wrapper for localtime to emulate localtime_r
64 #define wxGmtime_r gmtime_r
66 struct tm
*wxGmtime_r(const time_t*, struct tm
*)
67 #warning using pseudo thread-safe wrapper for gmtime to emulate gmtime_r
71 The three (main) classes declared in this header represent:
73 1. An absolute moment in the time (wxDateTime)
74 2. A difference between two moments in the time, positive or negative
76 3. A logical difference between two dates expressed in
77 years/months/weeks/days (wxDateSpan)
79 The following arithmetic operations are permitted (all others are not):
84 wxDateTime + wxTimeSpan = wxDateTime
85 wxDateTime + wxDateSpan = wxDateTime
86 wxTimeSpan + wxTimeSpan = wxTimeSpan
87 wxDateSpan + wxDateSpan = wxDateSpan
91 wxDateTime - wxDateTime = wxTimeSpan
92 wxDateTime - wxTimeSpan = wxDateTime
93 wxDateTime - wxDateSpan = wxDateTime
94 wxTimeSpan - wxTimeSpan = wxTimeSpan
95 wxDateSpan - wxDateSpan = wxDateSpan
99 wxTimeSpan * number = wxTimeSpan
100 number * wxTimeSpan = wxTimeSpan
101 wxDateSpan * number = wxDateSpan
102 number * wxDateSpan = wxDateSpan
106 -wxTimeSpan = wxTimeSpan
107 -wxDateSpan = wxDateSpan
109 For each binary operation OP (+, -, *) we have the following operatorOP=() as
110 a method and the method with a symbolic name OPER (Add, Subtract, Multiply)
111 as a synonym for it and another const method with the same name which returns
112 the changed copy of the object and operatorOP() as a global function which is
113 implemented in terms of the const version of OPEN. For the unary - we have
114 operator-() as a method, Neg() as synonym for it and Negate() which returns
115 the copy of the object with the changed sign.
118 // an invalid/default date time object which may be used as the default
119 // argument for arguments of type wxDateTime; it is also returned by all
120 // functions returning wxDateTime on failure (this is why it is also called
121 // wxInvalidDateTime)
122 class WXDLLIMPEXP_BASE wxDateTime
;
124 extern WXDLLIMPEXP_DATA_BASE(const wxChar
*) wxDefaultDateTimeFormat
;
125 extern WXDLLIMPEXP_DATA_BASE(const wxChar
*) wxDefaultTimeSpanFormat
;
126 extern WXDLLIMPEXP_DATA_BASE(const wxDateTime
) wxDefaultDateTime
;
128 #define wxInvalidDateTime wxDefaultDateTime
130 // ----------------------------------------------------------------------------
131 // wxDateTime represents an absolute moment in the time
132 // ----------------------------------------------------------------------------
134 class WXDLLIMPEXP_BASE wxDateTime
138 // ------------------------------------------------------------------------
140 // a small unsigned integer type for storing things like minutes,
141 // seconds &c. It should be at least short (i.e. not char) to contain
142 // the number of milliseconds - it may also be 'int' because there is
143 // no size penalty associated with it in our code, we don't store any
144 // data in this format
145 typedef unsigned short wxDateTime_t
;
148 // ------------------------------------------------------------------------
153 // the time in the current time zone
156 // zones from GMT (= Greenwhich Mean Time): they're guaranteed to be
157 // consequent numbers, so writing something like `GMT0 + offset' is
158 // safe if abs(offset) <= 12
160 // underscore stands for minus
161 GMT_12
, GMT_11
, GMT_10
, GMT_9
, GMT_8
, GMT_7
,
162 GMT_6
, GMT_5
, GMT_4
, GMT_3
, GMT_2
, GMT_1
,
164 GMT1
, GMT2
, GMT3
, GMT4
, GMT5
, GMT6
,
165 GMT7
, GMT8
, GMT9
, GMT10
, GMT11
, GMT12
,
166 // Note that GMT12 and GMT_12 are not the same: there is a difference
167 // of exactly one day between them
169 // some symbolic names for TZ
172 WET
= GMT0
, // Western Europe Time
173 WEST
= GMT1
, // Western Europe Summer Time
174 CET
= GMT1
, // Central Europe Time
175 CEST
= GMT2
, // Central Europe Summer Time
176 EET
= GMT2
, // Eastern Europe Time
177 EEST
= GMT3
, // Eastern Europe Summer Time
178 MSK
= GMT3
, // Moscow Time
179 MSD
= GMT4
, // Moscow Summer Time
182 AST
= GMT_4
, // Atlantic Standard Time
183 ADT
= GMT_3
, // Atlantic Daylight Time
184 EST
= GMT_5
, // Eastern Standard Time
185 EDT
= GMT_4
, // Eastern Daylight Saving Time
186 CST
= GMT_6
, // Central Standard Time
187 CDT
= GMT_5
, // Central Daylight Saving Time
188 MST
= GMT_7
, // Mountain Standard Time
189 MDT
= GMT_6
, // Mountain Daylight Saving Time
190 PST
= GMT_8
, // Pacific Standard Time
191 PDT
= GMT_7
, // Pacific Daylight Saving Time
192 HST
= GMT_10
, // Hawaiian Standard Time
193 AKST
= GMT_9
, // Alaska Standard Time
194 AKDT
= GMT_8
, // Alaska Daylight Saving Time
198 A_WST
= GMT8
, // Western Standard Time
199 A_CST
= GMT12
+ 1, // Central Standard Time (+9.5)
200 A_EST
= GMT10
, // Eastern Standard Time
201 A_ESST
= GMT11
, // Eastern Summer Time
203 // TODO add more symbolic timezone names here
205 // Universal Coordinated Time = the new and politically correct name
210 // the calendar systems we know about: notice that it's valid (for
211 // this classes purpose anyhow) to work with any of these calendars
212 // even with the dates before the historical appearance of the
216 Gregorian
, // current calendar
217 Julian
// calendar in use since -45 until the 1582 (or later)
219 // TODO Hebrew, Chinese, Maya, ... (just kidding) (or then may be not?)
222 // these values only are used to identify the different dates of
223 // adoption of the Gregorian calendar (see IsGregorian())
225 // All data and comments taken verbatim from "The Calendar FAQ (v 2.0)"
226 // by Claus Tøndering, http://www.pip.dknet.dk/~c-t/calendar.html
227 // except for the comments "we take".
229 // Symbol "->" should be read as "was followed by" in the comments
231 enum GregorianAdoption
233 Gr_Unknown
, // no data for this country or it's too uncertain to use
234 Gr_Standard
, // on the day 0 of Gregorian calendar: 15 Oct 1582
236 Gr_Alaska
, // Oct 1867 when Alaska became part of the USA
237 Gr_Albania
, // Dec 1912
239 Gr_Austria
= Gr_Unknown
, // Different regions on different dates
240 Gr_Austria_Brixen
, // 5 Oct 1583 -> 16 Oct 1583
241 Gr_Austria_Salzburg
= Gr_Austria_Brixen
,
242 Gr_Austria_Tyrol
= Gr_Austria_Brixen
,
243 Gr_Austria_Carinthia
, // 14 Dec 1583 -> 25 Dec 1583
244 Gr_Austria_Styria
= Gr_Austria_Carinthia
,
246 Gr_Belgium
, // Then part of the Netherlands
248 Gr_Bulgaria
= Gr_Unknown
, // Unknown precisely (from 1915 to 1920)
249 Gr_Bulgaria_1
, // 18 Mar 1916 -> 1 Apr 1916
250 Gr_Bulgaria_2
, // 31 Mar 1916 -> 14 Apr 1916
251 Gr_Bulgaria_3
, // 3 Sep 1920 -> 17 Sep 1920
253 Gr_Canada
= Gr_Unknown
, // Different regions followed the changes in
254 // Great Britain or France
256 Gr_China
= Gr_Unknown
, // Different authorities say:
257 Gr_China_1
, // 18 Dec 1911 -> 1 Jan 1912
258 Gr_China_2
, // 18 Dec 1928 -> 1 Jan 1929
260 Gr_Czechoslovakia
, // (Bohemia and Moravia) 6 Jan 1584 -> 17 Jan 1584
261 Gr_Denmark
, // (including Norway) 18 Feb 1700 -> 1 Mar 1700
264 Gr_Finland
, // Then part of Sweden
266 Gr_France
, // 9 Dec 1582 -> 20 Dec 1582
267 Gr_France_Alsace
, // 4 Feb 1682 -> 16 Feb 1682
268 Gr_France_Lorraine
, // 16 Feb 1760 -> 28 Feb 1760
269 Gr_France_Strasbourg
, // February 1682
271 Gr_Germany
= Gr_Unknown
, // Different states on different dates:
272 Gr_Germany_Catholic
, // 1583-1585 (we take 1584)
273 Gr_Germany_Prussia
, // 22 Aug 1610 -> 2 Sep 1610
274 Gr_Germany_Protestant
, // 18 Feb 1700 -> 1 Mar 1700
276 Gr_GreatBritain
, // 2 Sep 1752 -> 14 Sep 1752 (use 'cal(1)')
278 Gr_Greece
, // 9 Mar 1924 -> 23 Mar 1924
279 Gr_Hungary
, // 21 Oct 1587 -> 1 Nov 1587
280 Gr_Ireland
= Gr_GreatBritain
,
281 Gr_Italy
= Gr_Standard
,
283 Gr_Japan
= Gr_Unknown
, // Different authorities say:
284 Gr_Japan_1
, // 19 Dec 1872 -> 1 Jan 1873
285 Gr_Japan_2
, // 19 Dec 1892 -> 1 Jan 1893
286 Gr_Japan_3
, // 18 Dec 1918 -> 1 Jan 1919
288 Gr_Latvia
, // 1915-1918 (we take 1915)
289 Gr_Lithuania
, // 1915
290 Gr_Luxemburg
, // 14 Dec 1582 -> 25 Dec 1582
291 Gr_Netherlands
= Gr_Belgium
, // (including Belgium) 1 Jan 1583
293 // this is too weird to take into account: the Gregorian calendar was
294 // introduced twice in Groningen, first time 28 Feb 1583 was followed
295 // by 11 Mar 1583, then it has gone back to Julian in the summer of
296 // 1584 and then 13 Dec 1700 -> 12 Jan 1701 - which is
297 // the date we take here
298 Gr_Netherlands_Groningen
, // 13 Dec 1700 -> 12 Jan 1701
299 Gr_Netherlands_Gelderland
, // 30 Jun 1700 -> 12 Jul 1700
300 Gr_Netherlands_Utrecht
, // (and Overijssel) 30 Nov 1700->12 Dec 1700
301 Gr_Netherlands_Friesland
, // (and Drenthe) 31 Dec 1700 -> 12 Jan 1701
303 Gr_Norway
= Gr_Denmark
, // Then part of Denmark
304 Gr_Poland
= Gr_Standard
,
305 Gr_Portugal
= Gr_Standard
,
306 Gr_Romania
, // 31 Mar 1919 -> 14 Apr 1919
307 Gr_Russia
, // 31 Jan 1918 -> 14 Feb 1918
308 Gr_Scotland
= Gr_GreatBritain
,
309 Gr_Spain
= Gr_Standard
,
311 // Sweden has a curious history. Sweden decided to make a gradual
312 // change from the Julian to the Gregorian calendar. By dropping every
313 // leap year from 1700 through 1740 the eleven superfluous days would
314 // be omitted and from 1 Mar 1740 they would be in sync with the
315 // Gregorian calendar. (But in the meantime they would be in sync with
318 // So 1700 (which should have been a leap year in the Julian calendar)
319 // was not a leap year in Sweden. However, by mistake 1704 and 1708
320 // became leap years. This left Sweden out of synchronisation with
321 // both the Julian and the Gregorian world, so they decided to go back
322 // to the Julian calendar. In order to do this, they inserted an extra
323 // day in 1712, making that year a double leap year! So in 1712,
324 // February had 30 days in Sweden.
326 // Later, in 1753, Sweden changed to the Gregorian calendar by
327 // dropping 11 days like everyone else.
328 Gr_Sweden
= Gr_Finland
, // 17 Feb 1753 -> 1 Mar 1753
330 Gr_Switzerland
= Gr_Unknown
,// Different cantons used different dates
331 Gr_Switzerland_Catholic
, // 1583, 1584 or 1597 (we take 1584)
332 Gr_Switzerland_Protestant
, // 31 Dec 1700 -> 12 Jan 1701
334 Gr_Turkey
, // 1 Jan 1927
335 Gr_USA
= Gr_GreatBritain
,
336 Gr_Wales
= Gr_GreatBritain
,
337 Gr_Yugoslavia
// 1919
340 // the country parameter is used so far for calculating the start and
341 // the end of DST period and for deciding whether the date is a work
344 // TODO move this to intl.h
346 // Required for WinCE
353 Country_Unknown
, // no special information for this country
354 Country_Default
, // set the default country with SetCountry() method
355 // or use the default country with any other
357 // TODO add more countries (for this we must know about DST and/or
358 // holidays for this country)
360 // Western European countries: we assume that they all follow the same
361 // DST rules (true or false?)
362 Country_WesternEurope_Start
,
363 Country_EEC
= Country_WesternEurope_Start
,
367 Country_WesternEurope_End
= UK
,
372 // symbolic names for the months
375 Jan
, Feb
, Mar
, Apr
, May
, Jun
, Jul
, Aug
, Sep
, Oct
, Nov
, Dec
, Inv_Month
378 // symbolic names for the weekdays
381 Sun
, Mon
, Tue
, Wed
, Thu
, Fri
, Sat
, Inv_WeekDay
384 // invalid value for the year
387 Inv_Year
= SHRT_MIN
// should hold in wxDateTime_t
390 // flags for GetWeekDayName and GetMonthName
393 Name_Full
= 0x01, // return full name
394 Name_Abbr
= 0x02 // return abbreviated name
397 // flags for GetWeekOfYear and GetWeekOfMonth
400 Default_First
, // Sunday_First for US, Monday_First for the rest
401 Monday_First
, // week starts with a Monday
402 Sunday_First
// week starts with a Sunday
406 // ------------------------------------------------------------------------
408 // a class representing a time zone: basicly, this is just an offset
409 // (in seconds) from GMT
410 class WXDLLIMPEXP_BASE TimeZone
414 TimeZone(wxDateTime_t offset
= 0) { m_offset
= offset
; }
416 long GetOffset() const { return m_offset
; }
419 // offset for this timezone from GMT in seconds
423 // standard struct tm is limited to the years from 1900 (because
424 // tm_year field is the offset from 1900), so we use our own struct
425 // instead to represent broken down time
427 // NB: this struct should always be kept normalized (i.e. mon should
428 // be < 12, 1 <= day <= 31 &c), so use AddMonths(), AddDays()
429 // instead of modifying the member fields directly!
430 struct WXDLLIMPEXP_BASE Tm
432 wxDateTime_t msec
, sec
, min
, hour
, mday
;
436 // default ctor inits the object to an invalid value
439 // ctor from struct tm and the timezone
440 Tm(const struct tm
& tm
, const TimeZone
& tz
);
442 // check that the given date/time is valid (in Gregorian calendar)
443 bool IsValid() const;
446 WeekDay
GetWeekDay() // not const because wday may be changed
448 if ( wday
== Inv_WeekDay
)
451 return (WeekDay
)wday
;
454 // add the given number of months to the date keeping it normalized
455 void AddMonths(int monDiff
);
457 // add the given number of months to the date keeping it normalized
458 void AddDays(int dayDiff
);
461 // compute the weekday from other fields
462 void ComputeWeekDay();
464 // the timezone we correspond to
467 // these values can't be accessed directly because they're not always
468 // computed and we calculate them on demand
469 wxDateTime_t wday
, yday
;
473 // ------------------------------------------------------------------------
475 // set the current country
476 static void SetCountry(Country country
);
477 // get the current country
478 static Country
GetCountry();
480 // return true if the country is a West European one (in practice,
481 // this means that the same DST rules as for EEC apply)
482 static bool IsWestEuropeanCountry(Country country
= Country_Default
);
484 // return the current year
485 static int GetCurrentYear(Calendar cal
= Gregorian
);
487 // convert the year as returned by wxDateTime::GetYear() to a year
488 // suitable for BC/AD notation. The difference is that BC year 1
489 // corresponds to the year 0 (while BC year 0 didn't exist) and AD
490 // year N is just year N.
491 static int ConvertYearToBC(int year
);
493 // return the current month
494 static Month
GetCurrentMonth(Calendar cal
= Gregorian
);
496 // returns true if the given year is a leap year in the given calendar
497 static bool IsLeapYear(int year
= Inv_Year
, Calendar cal
= Gregorian
);
499 // get the century (19 for 1999, 20 for 2000 and -5 for 492 BC)
500 static int GetCentury(int year
= Inv_Year
);
502 // returns the number of days in this year (356 or 355 for Gregorian
503 // calendar usually :-)
504 static wxDateTime_t
GetNumberOfDays(int year
, Calendar cal
= Gregorian
);
506 // get the number of the days in the given month (default value for
507 // the year means the current one)
508 static wxDateTime_t
GetNumberOfDays(Month month
,
510 Calendar cal
= Gregorian
);
512 // get the full (default) or abbreviated month name in the current
513 // locale, returns empty string on error
514 static wxString
GetMonthName(Month month
,
515 NameFlags flags
= Name_Full
);
517 // get the full (default) or abbreviated weekday name in the current
518 // locale, returns empty string on error
519 static wxString
GetWeekDayName(WeekDay weekday
,
520 NameFlags flags
= Name_Full
);
522 // get the AM and PM strings in the current locale (may be empty)
523 static void GetAmPmStrings(wxString
*am
, wxString
*pm
);
525 // return true if the given country uses DST for this year
526 static bool IsDSTApplicable(int year
= Inv_Year
,
527 Country country
= Country_Default
);
529 // get the beginning of DST for this year, will return invalid object
530 // if no DST applicable in this year. The default value of the
531 // parameter means to take the current year.
532 static wxDateTime
GetBeginDST(int year
= Inv_Year
,
533 Country country
= Country_Default
);
534 // get the end of DST for this year, will return invalid object
535 // if no DST applicable in this year. The default value of the
536 // parameter means to take the current year.
537 static wxDateTime
GetEndDST(int year
= Inv_Year
,
538 Country country
= Country_Default
);
540 // return the wxDateTime object for the current time
541 static inline wxDateTime
Now();
543 // return the wxDateTime object for the current time with millisecond
544 // precision (if available on this platform)
545 static wxDateTime
UNow();
547 // return the wxDateTime object for today midnight: i.e. as Now() but
548 // with time set to 0
549 static inline wxDateTime
Today();
551 // constructors: you should test whether the constructor succeeded with
552 // IsValid() function. The values Inv_Month and Inv_Year for the
553 // parameters mean take current month and/or year values.
554 // ------------------------------------------------------------------------
556 // default ctor does not initialize the object, use Set()!
557 wxDateTime() { m_time
= wxLongLong((long)ULONG_MAX
, ULONG_MAX
); }
559 // from time_t: seconds since the Epoch 00:00:00 UTC, Jan 1, 1970)
560 #if (!(defined(__VISAGECPP__) && __IBMCPP__ >= 400))
561 // VA C++ confuses this with wxDateTime(double jdn) thinking it is a duplicate declaration
562 inline wxDateTime(time_t timet
);
564 // from broken down time/date (only for standard Unix range)
565 inline wxDateTime(const struct tm
& tm
);
566 // from broken down time/date (any range)
567 inline wxDateTime(const Tm
& tm
);
569 // from JDN (beware of rounding errors)
570 inline wxDateTime(double jdn
);
572 // from separate values for each component, date set to today
573 inline wxDateTime(wxDateTime_t hour
,
574 wxDateTime_t minute
= 0,
575 wxDateTime_t second
= 0,
576 wxDateTime_t millisec
= 0);
577 // from separate values for each component with explicit date
578 inline wxDateTime(wxDateTime_t day
, // day of the month
580 int year
= Inv_Year
, // 1999, not 99 please!
581 wxDateTime_t hour
= 0,
582 wxDateTime_t minute
= 0,
583 wxDateTime_t second
= 0,
584 wxDateTime_t millisec
= 0);
586 // default copy ctor ok
590 // assignment operators and Set() functions: all non const methods return
591 // the reference to this object. IsValid() should be used to test whether
592 // the function succeeded.
593 // ------------------------------------------------------------------------
595 // set to the current time
596 inline wxDateTime
& SetToCurrent();
598 #if (!(defined(__VISAGECPP__) && __IBMCPP__ >= 400))
599 // VA C++ confuses this with wxDateTime(double jdn) thinking it is a duplicate declaration
600 // set to given time_t value
601 inline wxDateTime
& Set(time_t timet
);
604 // set to given broken down time/date
605 wxDateTime
& Set(const struct tm
& tm
);
607 // set to given broken down time/date
608 inline wxDateTime
& Set(const Tm
& tm
);
610 // set to given JDN (beware of rounding errors)
611 wxDateTime
& Set(double jdn
);
613 // set to given time, date = today
614 wxDateTime
& Set(wxDateTime_t hour
,
615 wxDateTime_t minute
= 0,
616 wxDateTime_t second
= 0,
617 wxDateTime_t millisec
= 0);
619 // from separate values for each component with explicit date
620 // (defaults for month and year are the current values)
621 wxDateTime
& Set(wxDateTime_t day
,
623 int year
= Inv_Year
, // 1999, not 99 please!
624 wxDateTime_t hour
= 0,
625 wxDateTime_t minute
= 0,
626 wxDateTime_t second
= 0,
627 wxDateTime_t millisec
= 0);
629 // resets time to 00:00:00, doesn't change the date
630 wxDateTime
& ResetTime();
632 // the following functions don't change the values of the other
633 // fields, i.e. SetMinute() won't change either hour or seconds value
636 wxDateTime
& SetYear(int year
);
638 wxDateTime
& SetMonth(Month month
);
639 // set the day of the month
640 wxDateTime
& SetDay(wxDateTime_t day
);
642 wxDateTime
& SetHour(wxDateTime_t hour
);
644 wxDateTime
& SetMinute(wxDateTime_t minute
);
646 wxDateTime
& SetSecond(wxDateTime_t second
);
648 wxDateTime
& SetMillisecond(wxDateTime_t millisecond
);
650 // assignment operator from time_t
651 wxDateTime
& operator=(time_t timet
) { return Set(timet
); }
653 // assignment operator from broken down time/date
654 wxDateTime
& operator=(const struct tm
& tm
) { return Set(tm
); }
656 // assignment operator from broken down time/date
657 wxDateTime
& operator=(const Tm
& tm
) { return Set(tm
); }
659 // default assignment operator is ok
661 // calendar calculations (functions which set the date only leave the time
662 // unchanged, e.g. don't explictly zero it): SetXXX() functions modify the
663 // object itself, GetXXX() ones return a new object.
664 // ------------------------------------------------------------------------
666 // set to the given week day in the same week as this one
667 wxDateTime
& SetToWeekDayInSameWeek(WeekDay weekday
,
668 WeekFlags flags
= Monday_First
);
669 inline wxDateTime
GetWeekDayInSameWeek(WeekDay weekday
,
670 WeekFlags flags
= Monday_First
) const;
672 // set to the next week day following this one
673 wxDateTime
& SetToNextWeekDay(WeekDay weekday
);
674 inline wxDateTime
GetNextWeekDay(WeekDay weekday
) const;
676 // set to the previous week day before this one
677 wxDateTime
& SetToPrevWeekDay(WeekDay weekday
);
678 inline wxDateTime
GetPrevWeekDay(WeekDay weekday
) const;
680 // set to Nth occurence of given weekday in the given month of the
681 // given year (time is set to 0), return true on success and false on
682 // failure. n may be positive (1..5) or negative to count from the end
683 // of the month (see helper function SetToLastWeekDay())
684 bool SetToWeekDay(WeekDay weekday
,
686 Month month
= Inv_Month
,
687 int year
= Inv_Year
);
688 inline wxDateTime
GetWeekDay(WeekDay weekday
,
690 Month month
= Inv_Month
,
691 int year
= Inv_Year
) const;
693 // sets to the last weekday in the given month, year
694 inline bool SetToLastWeekDay(WeekDay weekday
,
695 Month month
= Inv_Month
,
696 int year
= Inv_Year
);
697 inline wxDateTime
GetLastWeekDay(WeekDay weekday
,
698 Month month
= Inv_Month
,
699 int year
= Inv_Year
);
701 // sets the date to the given day of the given week in the year,
702 // returns true on success and false if given date doesn't exist (e.g.
705 // these functions are badly defined as they're not the reverse of
706 // GetWeekOfYear(), use SetToTheWeekOfYear() instead
707 wxDEPRECATED( bool SetToTheWeek(wxDateTime_t numWeek
,
708 WeekDay weekday
= Mon
,
709 WeekFlags flags
= Monday_First
) );
710 wxDEPRECATED( wxDateTime
GetWeek(wxDateTime_t numWeek
,
711 WeekDay weekday
= Mon
,
712 WeekFlags flags
= Monday_First
) const );
714 // returns the date corresponding to the given week day of the given
715 // week (in ISO notation) of the specified year
716 static wxDateTime
SetToWeekOfYear(int year
,
717 wxDateTime_t numWeek
,
718 WeekDay weekday
= Mon
);
720 // sets the date to the last day of the given (or current) month or the
721 // given (or current) year
722 wxDateTime
& SetToLastMonthDay(Month month
= Inv_Month
,
723 int year
= Inv_Year
);
724 inline wxDateTime
GetLastMonthDay(Month month
= Inv_Month
,
725 int year
= Inv_Year
) const;
727 // sets to the given year day (1..365 or 366)
728 wxDateTime
& SetToYearDay(wxDateTime_t yday
);
729 inline wxDateTime
GetYearDay(wxDateTime_t yday
) const;
731 // The definitions below were taken verbatim from
733 // http://www.capecod.net/~pbaum/date/date0.htm
735 // (Peter Baum's home page)
737 // definition: The Julian Day Number, Julian Day, or JD of a
738 // particular instant of time is the number of days and fractions of a
739 // day since 12 hours Universal Time (Greenwich mean noon) on January
740 // 1 of the year -4712, where the year is given in the Julian
741 // proleptic calendar. The idea of using this reference date was
742 // originally proposed by Joseph Scalizer in 1582 to count years but
743 // it was modified by 19th century astronomers to count days. One
744 // could have equivalently defined the reference time to be noon of
745 // November 24, -4713 if were understood that Gregorian calendar rules
746 // were applied. Julian days are Julian Day Numbers and are not to be
747 // confused with Julian dates.
749 // definition: The Rata Die number is a date specified as the number
750 // of days relative to a base date of December 31 of the year 0. Thus
751 // January 1 of the year 1 is Rata Die day 1.
753 // get the Julian Day number (the fractional part specifies the time of
754 // the day, related to noon - beware of rounding errors!)
755 double GetJulianDayNumber() const;
756 double GetJDN() const { return GetJulianDayNumber(); }
758 // get the Modified Julian Day number: it is equal to JDN - 2400000.5
759 // and so integral MJDs correspond to the midnights (and not noons).
760 // MJD 0 is Nov 17, 1858
761 double GetModifiedJulianDayNumber() const { return GetJDN() - 2400000.5; }
762 double GetMJD() const { return GetModifiedJulianDayNumber(); }
764 // get the Rata Die number
765 double GetRataDie() const;
767 // TODO algorithms for calculating some important dates, such as
768 // religious holidays (Easter...) or moon/solar eclipses? Some
769 // algorithms can be found in the calendar FAQ
772 // Timezone stuff: a wxDateTime object constructed using given
773 // day/month/year/hour/min/sec values is interpreted as this moment in
774 // local time. Using the functions below, it may be converted to another
775 // time zone (e.g., the Unix epoch is wxDateTime(1, Jan, 1970).ToGMT()).
777 // These functions try to handle DST internally, but there is no magical
778 // way to know all rules for it in all countries in the world, so if the
779 // program can handle it itself (or doesn't want to handle it at all for
780 // whatever reason), the DST handling can be disabled with noDST.
781 // ------------------------------------------------------------------------
783 // transform to any given timezone
784 inline wxDateTime
ToTimezone(const TimeZone
& tz
, bool noDST
= false) const;
785 wxDateTime
& MakeTimezone(const TimeZone
& tz
, bool noDST
= false);
787 // interpret current value as being in another timezone and transform
789 inline wxDateTime
FromTimezone(const TimeZone
& tz
, bool noDST
= false) const;
790 wxDateTime
& MakeFromTimezone(const TimeZone
& tz
, bool noDST
= false);
792 // transform to/from GMT/UTC
793 wxDateTime
ToUTC(bool noDST
= false) const { return ToTimezone(UTC
, noDST
); }
794 wxDateTime
& MakeUTC(bool noDST
= false) { return MakeTimezone(UTC
, noDST
); }
796 wxDateTime
ToGMT(bool noDST
= false) const { return ToUTC(noDST
); }
797 wxDateTime
& MakeGMT(bool noDST
= false) { return MakeUTC(noDST
); }
799 wxDateTime
FromUTC(bool noDST
= false) const
800 { return FromTimezone(UTC
, noDST
); }
801 wxDateTime
& MakeFromUTC(bool noDST
= false)
802 { return MakeFromTimezone(UTC
, noDST
); }
804 // is daylight savings time in effect at this moment according to the
805 // rules of the specified country?
807 // Return value is > 0 if DST is in effect, 0 if it is not and -1 if
808 // the information is not available (this is compatible with ANSI C)
809 int IsDST(Country country
= Country_Default
) const;
812 // accessors: many of them take the timezone parameter which indicates the
813 // timezone for which to make the calculations and the default value means
814 // to do it for the current timezone of this machine (even if the function
815 // only operates with the date it's necessary because a date may wrap as
816 // result of timezone shift)
817 // ------------------------------------------------------------------------
819 // is the date valid?
820 inline bool IsValid() const { return m_time
!= wxInvalidDateTime
.m_time
; }
822 // get the broken down date/time representation in the given timezone
824 // If you wish to get several time components (day, month and year),
825 // consider getting the whole Tm strcuture first and retrieving the
826 // value from it - this is much more efficient
827 Tm
GetTm(const TimeZone
& tz
= Local
) const;
829 // get the number of seconds since the Unix epoch - returns (time_t)-1
830 // if the value is out of range
831 inline time_t GetTicks() const;
833 // get the year (returns Inv_Year if date is invalid)
834 int GetYear(const TimeZone
& tz
= Local
) const
835 { return GetTm(tz
).year
; }
836 // get the month (Inv_Month if date is invalid)
837 Month
GetMonth(const TimeZone
& tz
= Local
) const
838 { return (Month
)GetTm(tz
).mon
; }
839 // get the month day (in 1..31 range, 0 if date is invalid)
840 wxDateTime_t
GetDay(const TimeZone
& tz
= Local
) const
841 { return GetTm(tz
).mday
; }
842 // get the day of the week (Inv_WeekDay if date is invalid)
843 WeekDay
GetWeekDay(const TimeZone
& tz
= Local
) const
844 { return GetTm(tz
).GetWeekDay(); }
845 // get the hour of the day
846 wxDateTime_t
GetHour(const TimeZone
& tz
= Local
) const
847 { return GetTm(tz
).hour
; }
849 wxDateTime_t
GetMinute(const TimeZone
& tz
= Local
) const
850 { return GetTm(tz
).min
; }
852 wxDateTime_t
GetSecond(const TimeZone
& tz
= Local
) const
853 { return GetTm(tz
).sec
; }
855 wxDateTime_t
GetMillisecond(const TimeZone
& tz
= Local
) const
856 { return GetTm(tz
).msec
; }
858 // get the day since the year start (1..366, 0 if date is invalid)
859 wxDateTime_t
GetDayOfYear(const TimeZone
& tz
= Local
) const;
860 // get the week number since the year start (1..52 or 53, 0 if date is
862 wxDateTime_t
GetWeekOfYear(WeekFlags flags
= Monday_First
,
863 const TimeZone
& tz
= Local
) const;
864 // get the week number since the month start (1..5, 0 if date is
866 wxDateTime_t
GetWeekOfMonth(WeekFlags flags
= Monday_First
,
867 const TimeZone
& tz
= Local
) const;
869 // is this date a work day? This depends on a country, of course,
870 // because the holidays are different in different countries
871 bool IsWorkDay(Country country
= Country_Default
) const;
873 // is this date later than Gregorian calendar introduction for the
874 // given country (see enum GregorianAdoption)?
876 // NB: this function shouldn't be considered as absolute authority in
877 // the matter. Besides, for some countries the exact date of
878 // adoption of the Gregorian calendar is simply unknown.
879 bool IsGregorianDate(GregorianAdoption country
= Gr_Standard
) const;
881 // dos date and time format
882 // ------------------------------------------------------------------------
884 // set from the DOS packed format
885 wxDateTime
& SetFromDOS(unsigned long ddt
);
887 // pack the date in DOS format
888 unsigned long GetAsDOS() const;
890 // comparison (see also functions below for operator versions)
891 // ------------------------------------------------------------------------
893 // returns true if the two moments are strictly identical
894 inline bool IsEqualTo(const wxDateTime
& datetime
) const;
896 // returns true if the date is strictly earlier than the given one
897 inline bool IsEarlierThan(const wxDateTime
& datetime
) const;
899 // returns true if the date is strictly later than the given one
900 inline bool IsLaterThan(const wxDateTime
& datetime
) const;
902 // returns true if the date is strictly in the given range
903 inline bool IsStrictlyBetween(const wxDateTime
& t1
,
904 const wxDateTime
& t2
) const;
906 // returns true if the date is in the given range
907 inline bool IsBetween(const wxDateTime
& t1
, const wxDateTime
& t2
) const;
909 // do these two objects refer to the same date?
910 inline bool IsSameDate(const wxDateTime
& dt
) const;
912 // do these two objects have the same time?
913 inline bool IsSameTime(const wxDateTime
& dt
) const;
915 // are these two objects equal up to given timespan?
916 inline bool IsEqualUpTo(const wxDateTime
& dt
, const wxTimeSpan
& ts
) const;
918 inline bool operator<(const wxDateTime
& dt
) const
920 wxASSERT_MSG( IsValid() && dt
.IsValid(), _T("invalid wxDateTime") );
921 return GetValue() < dt
.GetValue();
924 inline bool operator<=(const wxDateTime
& dt
) const
926 wxASSERT_MSG( IsValid() && dt
.IsValid(), _T("invalid wxDateTime") );
927 return GetValue() <= dt
.GetValue();
930 inline bool operator>(const wxDateTime
& dt
) const
932 wxASSERT_MSG( IsValid() && dt
.IsValid(), _T("invalid wxDateTime") );
933 return GetValue() > dt
.GetValue();
936 inline bool operator>=(const wxDateTime
& dt
) const
938 wxASSERT_MSG( IsValid() && dt
.IsValid(), _T("invalid wxDateTime") );
939 return GetValue() >= dt
.GetValue();
942 inline bool operator==(const wxDateTime
& dt
) const
944 wxASSERT_MSG( IsValid() && dt
.IsValid(), _T("invalid wxDateTime") );
945 return GetValue() == dt
.GetValue();
948 inline bool operator!=(const wxDateTime
& dt
) const
950 wxASSERT_MSG( IsValid() && dt
.IsValid(), _T("invalid wxDateTime") );
951 return GetValue() != dt
.GetValue();
954 // arithmetics with dates (see also below for more operators)
955 // ------------------------------------------------------------------------
957 // return the sum of the date with a time span (positive or negative)
958 inline wxDateTime
Add(const wxTimeSpan
& diff
) const;
959 // add a time span (positive or negative)
960 inline wxDateTime
& Add(const wxTimeSpan
& diff
);
961 // add a time span (positive or negative)
962 inline wxDateTime
& operator+=(const wxTimeSpan
& diff
);
963 inline wxDateTime
operator+(const wxTimeSpan
& ts
) const
965 wxDateTime
dt(*this);
970 // return the difference of the date with a time span
971 inline wxDateTime
Subtract(const wxTimeSpan
& diff
) const;
972 // subtract a time span (positive or negative)
973 inline wxDateTime
& Subtract(const wxTimeSpan
& diff
);
974 // subtract a time span (positive or negative)
975 inline wxDateTime
& operator-=(const wxTimeSpan
& diff
);
976 inline wxDateTime
operator-(const wxTimeSpan
& ts
) const
978 wxDateTime
dt(*this);
983 // return the sum of the date with a date span
984 inline wxDateTime
Add(const wxDateSpan
& diff
) const;
985 // add a date span (positive or negative)
986 wxDateTime
& Add(const wxDateSpan
& diff
);
987 // add a date span (positive or negative)
988 inline wxDateTime
& operator+=(const wxDateSpan
& diff
);
989 inline wxDateTime
operator+(const wxDateSpan
& ds
) const
991 wxDateTime
dt(*this);
996 // return the difference of the date with a date span
997 inline wxDateTime
Subtract(const wxDateSpan
& diff
) const;
998 // subtract a date span (positive or negative)
999 inline wxDateTime
& Subtract(const wxDateSpan
& diff
);
1000 // subtract a date span (positive or negative)
1001 inline wxDateTime
& operator-=(const wxDateSpan
& diff
);
1002 inline wxDateTime
operator-(const wxDateSpan
& ds
) const
1004 wxDateTime
dt(*this);
1009 // return the difference between two dates
1010 inline wxTimeSpan
Subtract(const wxDateTime
& dt
) const;
1011 inline wxTimeSpan
operator-(const wxDateTime
& dt2
) const;
1013 // conversion to/from text: all conversions from text return the pointer to
1014 // the next character following the date specification (i.e. the one where
1015 // the scan had to stop) or NULL on failure.
1016 // ------------------------------------------------------------------------
1018 // parse a string in RFC 822 format (found e.g. in mail headers and
1019 // having the form "Wed, 10 Feb 1999 19:07:07 +0100")
1020 const wxChar
*ParseRfc822Date(const wxChar
* date
);
1021 // parse a date/time in the given format (see strptime(3)), fill in
1022 // the missing (in the string) fields with the values of dateDef (by
1023 // default, they will not change if they had valid values or will
1024 // default to Today() otherwise)
1025 const wxChar
*ParseFormat(const wxChar
*date
,
1026 const wxChar
*format
= wxDefaultDateTimeFormat
,
1027 const wxDateTime
& dateDef
= wxDefaultDateTime
);
1028 // parse a string containing the date/time in "free" format, this
1029 // function will try to make an educated guess at the string contents
1030 const wxChar
*ParseDateTime(const wxChar
*datetime
);
1031 // parse a string containing the date only in "free" format (less
1032 // flexible than ParseDateTime)
1033 const wxChar
*ParseDate(const wxChar
*date
);
1034 // parse a string containing the time only in "free" format
1035 const wxChar
*ParseTime(const wxChar
*time
);
1037 // this function accepts strftime()-like format string (default
1038 // argument corresponds to the preferred date and time representation
1039 // for the current locale) and returns the string containing the
1040 // resulting text representation
1041 wxString
Format(const wxChar
*format
= wxDefaultDateTimeFormat
,
1042 const TimeZone
& tz
= Local
) const;
1043 // preferred date representation for the current locale
1044 wxString
FormatDate() const { return Format(_T("%x")); }
1045 // preferred time representation for the current locale
1046 wxString
FormatTime() const { return Format(_T("%X")); }
1047 // returns the string representing the date in ISO 8601 format
1049 wxString
FormatISODate() const { return Format(_T("%Y-%m-%d")); }
1050 // returns the string representing the time in ISO 8601 format
1052 wxString
FormatISOTime() const { return Format(_T("%H:%M:%S")); }
1055 // ------------------------------------------------------------------------
1057 // construct from internal representation
1058 wxDateTime(const wxLongLong
& time
) { m_time
= time
; }
1060 // get the internal representation
1061 inline wxLongLong
GetValue() const;
1063 // a helper function to get the current time_t
1064 static time_t GetTimeNow() { return time((time_t *)NULL
); }
1066 // another one to get the current time broken down
1067 static struct tm
*GetTmNow()
1069 time_t t
= GetTimeNow();
1070 return localtime(&t
);
1073 // get current time using thread-safe function
1074 static struct tm
*GetTmNow(struct tm
*tmstruct
);
1077 // the current country - as it's the same for all program objects (unless
1078 // it runs on a _really_ big cluster system :-), this is a static member:
1079 // see SetCountry() and GetCountry()
1080 static Country ms_country
;
1082 // this constant is used to transform a time_t value to the internal
1083 // representation, as time_t is in seconds and we use milliseconds it's
1085 static const long TIME_T_FACTOR
;
1087 // returns true if we fall in range in which we can use standard ANSI C
1089 inline bool IsInStdRange() const;
1091 // the internal representation of the time is the amount of milliseconds
1092 // elapsed since the origin which is set by convention to the UNIX/C epoch
1093 // value: the midnight of January 1, 1970 (UTC)
1097 // ----------------------------------------------------------------------------
1098 // This class contains a difference between 2 wxDateTime values, so it makes
1099 // sense to add it to wxDateTime and it is the result of subtraction of 2
1100 // objects of that class. See also wxDateSpan.
1101 // ----------------------------------------------------------------------------
1103 class WXDLLIMPEXP_BASE wxTimeSpan
1107 // ------------------------------------------------------------------------
1109 // return the timespan for the given number of seconds
1110 static wxTimeSpan
Seconds(long sec
) { return wxTimeSpan(0, 0, sec
); }
1111 static wxTimeSpan
Second() { return Seconds(1); }
1113 // return the timespan for the given number of minutes
1114 static wxTimeSpan
Minutes(long min
) { return wxTimeSpan(0, min
, 0 ); }
1115 static wxTimeSpan
Minute() { return Minutes(1); }
1117 // return the timespan for the given number of hours
1118 static wxTimeSpan
Hours(long hours
) { return wxTimeSpan(hours
, 0, 0); }
1119 static wxTimeSpan
Hour() { return Hours(1); }
1121 // return the timespan for the given number of days
1122 static wxTimeSpan
Days(long days
) { return Hours(24 * days
); }
1123 static wxTimeSpan
Day() { return Days(1); }
1125 // return the timespan for the given number of weeks
1126 static wxTimeSpan
Weeks(long days
) { return Days(7 * days
); }
1127 static wxTimeSpan
Week() { return Weeks(1); }
1129 // default ctor constructs the 0 time span
1132 // from separate values for each component, date set to 0 (hours are
1133 // not restricted to 0..24 range, neither are minutes, seconds or
1135 inline wxTimeSpan(long hours
,
1138 long milliseconds
= 0);
1140 // default copy ctor is ok
1144 // arithmetics with time spans (see also below for more operators)
1145 // ------------------------------------------------------------------------
1147 // return the sum of two timespans
1148 inline wxTimeSpan
Add(const wxTimeSpan
& diff
) const;
1149 // add two timespans together
1150 inline wxTimeSpan
& Add(const wxTimeSpan
& diff
);
1151 // add two timespans together
1152 wxTimeSpan
& operator+=(const wxTimeSpan
& diff
) { return Add(diff
); }
1153 inline wxTimeSpan
operator+(const wxTimeSpan
& ts
) const
1155 return wxTimeSpan(GetValue() + ts
.GetValue());
1158 // return the difference of two timespans
1159 inline wxTimeSpan
Subtract(const wxTimeSpan
& diff
) const;
1160 // subtract another timespan
1161 inline wxTimeSpan
& Subtract(const wxTimeSpan
& diff
);
1162 // subtract another timespan
1163 wxTimeSpan
& operator-=(const wxTimeSpan
& diff
) { return Subtract(diff
); }
1164 inline wxTimeSpan
operator-(const wxTimeSpan
& ts
)
1166 return wxTimeSpan(GetValue() - ts
.GetValue());
1169 // multiply timespan by a scalar
1170 inline wxTimeSpan
Multiply(int n
) const;
1171 // multiply timespan by a scalar
1172 inline wxTimeSpan
& Multiply(int n
);
1173 // multiply timespan by a scalar
1174 wxTimeSpan
& operator*=(int n
) { return Multiply(n
); }
1175 inline wxTimeSpan
operator*(int n
) const
1177 return wxTimeSpan(*this).Multiply(n
);
1180 // return this timespan with opposite sign
1181 wxTimeSpan
Negate() const { return wxTimeSpan(-GetValue()); }
1182 // negate the value of the timespan
1183 wxTimeSpan
& Neg() { m_diff
= -GetValue(); return *this; }
1184 // negate the value of the timespan
1185 wxTimeSpan
& operator-() { return Neg(); }
1187 // return the absolute value of the timespan: does _not_ modify the
1189 inline wxTimeSpan
Abs() const;
1191 // there is intentionally no division because we don't want to
1192 // introduce rounding errors in time calculations
1194 // comparaison (see also operator versions below)
1195 // ------------------------------------------------------------------------
1197 // is the timespan null?
1198 bool IsNull() const { return m_diff
== 0l; }
1199 // returns true if the timespan is null
1200 bool operator!() const { return !IsNull(); }
1202 // is the timespan positive?
1203 bool IsPositive() const { return m_diff
> 0l; }
1205 // is the timespan negative?
1206 bool IsNegative() const { return m_diff
< 0l; }
1208 // are two timespans equal?
1209 inline bool IsEqualTo(const wxTimeSpan
& ts
) const;
1210 // compare two timestamps: works with the absolute values, i.e. -2
1211 // hours is longer than 1 hour. Also, it will return false if the
1212 // timespans are equal in absolute value.
1213 inline bool IsLongerThan(const wxTimeSpan
& ts
) const;
1214 // compare two timestamps: works with the absolute values, i.e. 1
1215 // hour is shorter than -2 hours. Also, it will return false if the
1216 // timespans are equal in absolute value.
1217 bool IsShorterThan(const wxTimeSpan
& t
) const { return !IsLongerThan(t
); }
1219 inline bool operator<(const wxTimeSpan
&ts
) const
1221 return GetValue() < ts
.GetValue();
1224 inline bool operator<=(const wxTimeSpan
&ts
) const
1226 return GetValue() <= ts
.GetValue();
1229 inline bool operator>(const wxTimeSpan
&ts
) const
1231 return GetValue() > ts
.GetValue();
1234 inline bool operator>=(const wxTimeSpan
&ts
) const
1236 return GetValue() >= ts
.GetValue();
1239 inline bool operator==(const wxTimeSpan
&ts
) const
1241 return GetValue() == ts
.GetValue();
1244 inline bool operator!=(const wxTimeSpan
&ts
) const
1246 return GetValue() != ts
.GetValue();
1249 // breaking into days, hours, minutes and seconds
1250 // ------------------------------------------------------------------------
1252 // get the max number of weeks in this timespan
1253 inline int GetWeeks() const;
1254 // get the max number of days in this timespan
1255 inline int GetDays() const;
1256 // get the max number of hours in this timespan
1257 inline int GetHours() const;
1258 // get the max number of minutes in this timespan
1259 inline int GetMinutes() const;
1260 // get the max number of seconds in this timespan
1261 inline wxLongLong
GetSeconds() const;
1262 // get the number of milliseconds in this timespan
1263 wxLongLong
GetMilliseconds() const { return m_diff
; }
1265 // conversion to text
1266 // ------------------------------------------------------------------------
1268 // this function accepts strftime()-like format string (default
1269 // argument corresponds to the preferred date and time representation
1270 // for the current locale) and returns the string containing the
1271 // resulting text representation. Notice that only some of format
1272 // specifiers valid for wxDateTime are valid for wxTimeSpan: hours,
1273 // minutes and seconds make sense, but not "PM/AM" string for example.
1274 wxString
Format(const wxChar
*format
= wxDefaultTimeSpanFormat
) const;
1277 // ------------------------------------------------------------------------
1279 // construct from internal representation
1280 wxTimeSpan(const wxLongLong
& diff
) { m_diff
= diff
; }
1282 // get the internal representation
1283 wxLongLong
GetValue() const { return m_diff
; }
1286 // the (signed) time span in milliseconds
1290 // ----------------------------------------------------------------------------
1291 // This class is a "logical time span" and is useful for implementing program
1292 // logic for such things as "add one month to the date" which, in general,
1293 // doesn't mean to add 60*60*24*31 seconds to it, but to take the same date
1294 // the next month (to understand that this is indeed different consider adding
1295 // one month to Feb, 15 - we want to get Mar, 15, of course).
1297 // When adding a month to the date, all lesser components (days, hours, ...)
1298 // won't be changed unless the resulting date would be invalid: for example,
1299 // Jan 31 + 1 month will be Feb 28, not (non existing) Feb 31.
1301 // Because of this feature, adding and subtracting back again the same
1302 // wxDateSpan will *not*, in general give back the original date: Feb 28 - 1
1303 // month will be Jan 28, not Jan 31!
1305 // wxDateSpan can be either positive or negative. They may be
1306 // multiplied by scalars which multiply all deltas by the scalar: i.e. 2*(1
1307 // month and 1 day) is 2 months and 2 days. They can be added together and
1308 // with wxDateTime or wxTimeSpan, but the type of result is different for each
1311 // Beware about weeks: if you specify both weeks and days, the total number of
1312 // days added will be 7*weeks + days! See also GetTotalDays() function.
1314 // Equality operators are defined for wxDateSpans. Two datespans are equal if
1315 // they both give the same target date when added to *every* source date.
1316 // Thus wxDateSpan::Months(1) is not equal to wxDateSpan::Days(30), because
1317 // they not give the same date when added to 1 Feb. But wxDateSpan::Days(14) is
1318 // equal to wxDateSpan::Weeks(2)
1320 // Finally, notice that for adding hours, minutes &c you don't need this
1321 // class: wxTimeSpan will do the job because there are no subtleties
1322 // associated with those.
1323 // ----------------------------------------------------------------------------
1325 class WXDLLIMPEXP_BASE wxDateSpan
1329 // ------------------------------------------------------------------------
1331 // this many years/months/weeks/days
1332 wxDateSpan(int years
= 0, int months
= 0, int weeks
= 0, int days
= 0)
1340 // get an object for the given number of days
1341 static wxDateSpan
Days(int days
) { return wxDateSpan(0, 0, 0, days
); }
1342 static wxDateSpan
Day() { return Days(1); }
1344 // get an object for the given number of weeks
1345 static wxDateSpan
Weeks(int weeks
) { return wxDateSpan(0, 0, weeks
, 0); }
1346 static wxDateSpan
Week() { return Weeks(1); }
1348 // get an object for the given number of months
1349 static wxDateSpan
Months(int mon
) { return wxDateSpan(0, mon
, 0, 0); }
1350 static wxDateSpan
Month() { return Months(1); }
1352 // get an object for the given number of years
1353 static wxDateSpan
Years(int years
) { return wxDateSpan(years
, 0, 0, 0); }
1354 static wxDateSpan
Year() { return Years(1); }
1356 // default copy ctor is ok
1360 // accessors (all SetXXX() return the (modified) wxDateSpan object)
1361 // ------------------------------------------------------------------------
1363 // set number of years
1364 wxDateSpan
& SetYears(int n
) { m_years
= n
; return *this; }
1365 // set number of months
1366 wxDateSpan
& SetMonths(int n
) { m_months
= n
; return *this; }
1367 // set number of weeks
1368 wxDateSpan
& SetWeeks(int n
) { m_weeks
= n
; return *this; }
1369 // set number of days
1370 wxDateSpan
& SetDays(int n
) { m_days
= n
; return *this; }
1372 // get number of years
1373 int GetYears() const { return m_years
; }
1374 // get number of months
1375 int GetMonths() const { return m_months
; }
1376 // get number of weeks
1377 int GetWeeks() const { return m_weeks
; }
1378 // get number of days
1379 int GetDays() const { return m_days
; }
1380 // returns 7*GetWeeks() + GetDays()
1381 int GetTotalDays() const { return 7*m_weeks
+ m_days
; }
1383 // arithmetics with date spans (see also below for more operators)
1384 // ------------------------------------------------------------------------
1386 // return sum of two date spans
1387 inline wxDateSpan
Add(const wxDateSpan
& other
) const;
1388 // add another wxDateSpan to us
1389 inline wxDateSpan
& Add(const wxDateSpan
& other
);
1390 // add another wxDateSpan to us
1391 inline wxDateSpan
& operator+=(const wxDateSpan
& other
);
1392 inline wxDateSpan
operator+(const wxDateSpan
& ds
) const
1394 return wxDateSpan(GetYears() + ds
.GetYears(),
1395 GetMonths() + ds
.GetMonths(),
1396 GetWeeks() + ds
.GetWeeks(),
1397 GetDays() + ds
.GetDays());
1400 // return difference of two date spans
1401 inline wxDateSpan
Subtract(const wxDateSpan
& other
) const;
1402 // subtract another wxDateSpan from us
1403 inline wxDateSpan
& Subtract(const wxDateSpan
& other
);
1404 // subtract another wxDateSpan from us
1405 inline wxDateSpan
& operator-=(const wxDateSpan
& other
);
1406 inline wxDateSpan
operator-(const wxDateSpan
& ds
) const
1408 return wxDateSpan(GetYears() - ds
.GetYears(),
1409 GetMonths() - ds
.GetMonths(),
1410 GetWeeks() - ds
.GetWeeks(),
1411 GetDays() - ds
.GetDays());
1414 // return a copy of this time span with changed sign
1415 inline wxDateSpan
Negate() const;
1416 // inverse the sign of this timespan
1417 inline wxDateSpan
& Neg();
1418 // inverse the sign of this timespan
1419 wxDateSpan
& operator-() { return Neg(); }
1421 // return the date span proportional to this one with given factor
1422 inline wxDateSpan
Multiply(int factor
) const;
1423 // multiply all components by a (signed) number
1424 inline wxDateSpan
& Multiply(int factor
);
1425 // multiply all components by a (signed) number
1426 inline wxDateSpan
& operator*=(int factor
) { return Multiply(factor
); }
1427 inline wxDateSpan
operator*(int n
) const
1429 return wxDateSpan(*this).Multiply(n
);
1432 // ds1 == d2 if and only if for every wxDateTime t t + ds1 == t + ds2
1433 inline bool operator==(const wxDateSpan
& ds
) const
1435 return GetYears() == ds
.GetYears() &&
1436 GetMonths() == ds
.GetMonths() &&
1437 GetTotalDays() == ds
.GetTotalDays();
1440 inline bool operator!=(const wxDateSpan
& ds
) const
1442 return !(*this == ds
);
1452 // ----------------------------------------------------------------------------
1453 // wxDateTimeArray: array of dates.
1454 // ----------------------------------------------------------------------------
1456 WX_DECLARE_USER_EXPORTED_OBJARRAY(wxDateTime
, wxDateTimeArray
, WXDLLIMPEXP_BASE
);
1458 // ----------------------------------------------------------------------------
1459 // wxDateTimeHolidayAuthority: an object of this class will decide whether a
1460 // given date is a holiday and is used by all functions working with "work
1463 // NB: the base class is an ABC, derived classes must implement the pure
1464 // virtual methods to work with the holidays they correspond to.
1465 // ----------------------------------------------------------------------------
1467 class WXDLLIMPEXP_BASE wxDateTimeHolidayAuthority
;
1468 WX_DEFINE_USER_EXPORTED_ARRAY_PTR(wxDateTimeHolidayAuthority
*,
1469 wxHolidayAuthoritiesArray
,
1470 class WXDLLIMPEXP_BASE
);
1472 class wxDateTimeHolidaysModule
;
1473 class WXDLLIMPEXP_BASE wxDateTimeHolidayAuthority
1475 friend class wxDateTimeHolidaysModule
;
1477 // returns true if the given date is a holiday
1478 static bool IsHoliday(const wxDateTime
& dt
);
1480 // fills the provided array with all holidays in the given range, returns
1481 // the number of them
1482 static size_t GetHolidaysInRange(const wxDateTime
& dtStart
,
1483 const wxDateTime
& dtEnd
,
1484 wxDateTimeArray
& holidays
);
1486 // clear the list of holiday authorities
1487 static void ClearAllAuthorities();
1489 // add a new holiday authority (the pointer will be deleted by
1490 // wxDateTimeHolidayAuthority)
1491 static void AddAuthority(wxDateTimeHolidayAuthority
*auth
);
1493 // the base class must have a virtual dtor
1494 virtual ~wxDateTimeHolidayAuthority();
1497 // this function is called to determine whether a given day is a holiday
1498 virtual bool DoIsHoliday(const wxDateTime
& dt
) const = 0;
1500 // this function should fill the array with all holidays between the two
1501 // given dates - it is implemented in the base class, but in a very
1502 // inefficient way (it just iterates over all days and uses IsHoliday() for
1503 // each of them), so it must be overridden in the derived class where the
1504 // base class version may be explicitly used if needed
1506 // returns the number of holidays in the given range and fills holidays
1508 virtual size_t DoGetHolidaysInRange(const wxDateTime
& dtStart
,
1509 const wxDateTime
& dtEnd
,
1510 wxDateTimeArray
& holidays
) const = 0;
1513 // all holiday authorities
1514 static wxHolidayAuthoritiesArray ms_authorities
;
1517 // the holidays for this class are all Saturdays and Sundays
1518 class WXDLLIMPEXP_BASE wxDateTimeWorkDays
: public wxDateTimeHolidayAuthority
1521 virtual bool DoIsHoliday(const wxDateTime
& dt
) const;
1522 virtual size_t DoGetHolidaysInRange(const wxDateTime
& dtStart
,
1523 const wxDateTime
& dtEnd
,
1524 wxDateTimeArray
& holidays
) const;
1527 // ============================================================================
1528 // inline functions implementation
1529 // ============================================================================
1531 // ----------------------------------------------------------------------------
1533 // ----------------------------------------------------------------------------
1535 #define MILLISECONDS_PER_DAY 86400000l
1537 // some broken compilers (HP-UX CC) refuse to compile the "normal" version, but
1538 // using a temp variable always might prevent other compilers from optimising
1539 // it away - hence use of this ugly macro
1541 #define MODIFY_AND_RETURN(op) return wxDateTime(*this).op
1543 #define MODIFY_AND_RETURN(op) wxDateTime dt(*this); dt.op; return dt
1546 // ----------------------------------------------------------------------------
1547 // wxDateTime construction
1548 // ----------------------------------------------------------------------------
1550 inline bool wxDateTime::IsInStdRange() const
1552 return m_time
>= 0l && (m_time
/ TIME_T_FACTOR
) < LONG_MAX
;
1556 inline wxDateTime
wxDateTime::Now()
1559 return wxDateTime(*GetTmNow(&tmstruct
));
1563 inline wxDateTime
wxDateTime::Today()
1565 wxDateTime
dt(Now());
1571 #if (!(defined(__VISAGECPP__) && __IBMCPP__ >= 400))
1572 inline wxDateTime
& wxDateTime::Set(time_t timet
)
1574 // assign first to avoid long multiplication overflow!
1575 m_time
= timet
- WX_TIME_BASE_OFFSET
;
1576 m_time
*= TIME_T_FACTOR
;
1582 inline wxDateTime
& wxDateTime::SetToCurrent()
1588 #if (!(defined(__VISAGECPP__) && __IBMCPP__ >= 400))
1589 inline wxDateTime::wxDateTime(time_t timet
)
1595 inline wxDateTime::wxDateTime(const struct tm
& tm
)
1600 inline wxDateTime::wxDateTime(const Tm
& tm
)
1605 inline wxDateTime::wxDateTime(double jdn
)
1610 inline wxDateTime
& wxDateTime::Set(const Tm
& tm
)
1612 wxASSERT_MSG( tm
.IsValid(), _T("invalid broken down date/time") );
1614 return Set(tm
.mday
, (Month
)tm
.mon
, tm
.year
,
1615 tm
.hour
, tm
.min
, tm
.sec
, tm
.msec
);
1618 inline wxDateTime::wxDateTime(wxDateTime_t hour
,
1619 wxDateTime_t minute
,
1620 wxDateTime_t second
,
1621 wxDateTime_t millisec
)
1623 Set(hour
, minute
, second
, millisec
);
1626 inline wxDateTime::wxDateTime(wxDateTime_t day
,
1630 wxDateTime_t minute
,
1631 wxDateTime_t second
,
1632 wxDateTime_t millisec
)
1634 Set(day
, month
, year
, hour
, minute
, second
, millisec
);
1637 // ----------------------------------------------------------------------------
1638 // wxDateTime accessors
1639 // ----------------------------------------------------------------------------
1641 inline wxLongLong
wxDateTime::GetValue() const
1643 wxASSERT_MSG( IsValid(), _T("invalid wxDateTime"));
1648 inline time_t wxDateTime::GetTicks() const
1650 wxASSERT_MSG( IsValid(), _T("invalid wxDateTime"));
1651 if ( !IsInStdRange() )
1656 return (time_t)((m_time
/ (long)TIME_T_FACTOR
).GetLo())+WX_TIME_BASE_OFFSET
;
1659 inline bool wxDateTime::SetToLastWeekDay(WeekDay weekday
,
1663 return SetToWeekDay(weekday
, -1, month
, year
);
1667 wxDateTime::GetWeekDayInSameWeek(WeekDay weekday
,
1668 WeekFlags
WXUNUSED(flags
)) const
1670 MODIFY_AND_RETURN( SetToWeekDayInSameWeek(weekday
) );
1673 inline wxDateTime
wxDateTime::GetNextWeekDay(WeekDay weekday
) const
1675 MODIFY_AND_RETURN( SetToNextWeekDay(weekday
) );
1678 inline wxDateTime
wxDateTime::GetPrevWeekDay(WeekDay weekday
) const
1680 MODIFY_AND_RETURN( SetToPrevWeekDay(weekday
) );
1683 inline wxDateTime
wxDateTime::GetWeekDay(WeekDay weekday
,
1688 wxDateTime
dt(*this);
1690 return dt
.SetToWeekDay(weekday
, n
, month
, year
) ? dt
: wxInvalidDateTime
;
1693 inline wxDateTime
wxDateTime::GetLastWeekDay(WeekDay weekday
,
1697 wxDateTime
dt(*this);
1699 return dt
.SetToLastWeekDay(weekday
, month
, year
) ? dt
: wxInvalidDateTime
;
1702 inline wxDateTime
wxDateTime::GetLastMonthDay(Month month
, int year
) const
1704 MODIFY_AND_RETURN( SetToLastMonthDay(month
, year
) );
1707 inline wxDateTime
wxDateTime::GetYearDay(wxDateTime_t yday
) const
1709 MODIFY_AND_RETURN( SetToYearDay(yday
) );
1712 // ----------------------------------------------------------------------------
1713 // wxDateTime comparison
1714 // ----------------------------------------------------------------------------
1716 inline bool wxDateTime::IsEqualTo(const wxDateTime
& datetime
) const
1718 wxASSERT_MSG( IsValid() && datetime
.IsValid(), _T("invalid wxDateTime"));
1720 return m_time
== datetime
.m_time
;
1723 inline bool wxDateTime::IsEarlierThan(const wxDateTime
& datetime
) const
1725 wxASSERT_MSG( IsValid() && datetime
.IsValid(), _T("invalid wxDateTime"));
1727 return m_time
< datetime
.m_time
;
1730 inline bool wxDateTime::IsLaterThan(const wxDateTime
& datetime
) const
1732 wxASSERT_MSG( IsValid() && datetime
.IsValid(), _T("invalid wxDateTime"));
1734 return m_time
> datetime
.m_time
;
1737 inline bool wxDateTime::IsStrictlyBetween(const wxDateTime
& t1
,
1738 const wxDateTime
& t2
) const
1740 // no need for assert, will be checked by the functions we call
1741 return IsLaterThan(t1
) && IsEarlierThan(t2
);
1744 inline bool wxDateTime::IsBetween(const wxDateTime
& t1
,
1745 const wxDateTime
& t2
) const
1747 // no need for assert, will be checked by the functions we call
1748 return IsEqualTo(t1
) || IsEqualTo(t2
) || IsStrictlyBetween(t1
, t2
);
1751 inline bool wxDateTime::IsSameDate(const wxDateTime
& dt
) const
1756 return tm1
.year
== tm2
.year
&&
1757 tm1
.mon
== tm2
.mon
&&
1758 tm1
.mday
== tm2
.mday
;
1761 inline bool wxDateTime::IsSameTime(const wxDateTime
& dt
) const
1763 // notice that we can't do something like this:
1765 // m_time % MILLISECONDS_PER_DAY == dt.m_time % MILLISECONDS_PER_DAY
1767 // because we have also to deal with (possibly) different DST settings!
1771 return tm1
.hour
== tm2
.hour
&&
1772 tm1
.min
== tm2
.min
&&
1773 tm1
.sec
== tm2
.sec
&&
1774 tm1
.msec
== tm2
.msec
;
1777 inline bool wxDateTime::IsEqualUpTo(const wxDateTime
& dt
,
1778 const wxTimeSpan
& ts
) const
1780 return IsBetween(dt
.Subtract(ts
), dt
.Add(ts
));
1783 // ----------------------------------------------------------------------------
1784 // wxDateTime arithmetics
1785 // ----------------------------------------------------------------------------
1787 inline wxDateTime
wxDateTime::Add(const wxTimeSpan
& diff
) const
1789 wxASSERT_MSG( IsValid(), _T("invalid wxDateTime"));
1791 return wxDateTime(m_time
+ diff
.GetValue());
1794 inline wxDateTime
& wxDateTime::Add(const wxTimeSpan
& diff
)
1796 wxASSERT_MSG( IsValid(), _T("invalid wxDateTime"));
1798 m_time
+= diff
.GetValue();
1803 inline wxDateTime
& wxDateTime::operator+=(const wxTimeSpan
& diff
)
1808 inline wxDateTime
wxDateTime::Subtract(const wxTimeSpan
& diff
) const
1810 wxASSERT_MSG( IsValid(), _T("invalid wxDateTime"));
1812 return wxDateTime(m_time
- diff
.GetValue());
1815 inline wxDateTime
& wxDateTime::Subtract(const wxTimeSpan
& diff
)
1817 wxASSERT_MSG( IsValid(), _T("invalid wxDateTime"));
1819 m_time
-= diff
.GetValue();
1824 inline wxDateTime
& wxDateTime::operator-=(const wxTimeSpan
& diff
)
1826 return Subtract(diff
);
1829 inline wxTimeSpan
wxDateTime::Subtract(const wxDateTime
& datetime
) const
1831 wxASSERT_MSG( IsValid() && datetime
.IsValid(), _T("invalid wxDateTime"));
1833 return wxTimeSpan(GetValue() - datetime
.GetValue());
1836 inline wxTimeSpan
wxDateTime::operator-(const wxDateTime
& dt2
) const
1838 return this->Subtract(dt2
);
1841 inline wxDateTime
wxDateTime::Add(const wxDateSpan
& diff
) const
1843 return wxDateTime(*this).Add(diff
);
1846 inline wxDateTime
& wxDateTime::Subtract(const wxDateSpan
& diff
)
1848 return Add(diff
.Negate());
1851 inline wxDateTime
wxDateTime::Subtract(const wxDateSpan
& diff
) const
1853 return wxDateTime(*this).Subtract(diff
);
1856 inline wxDateTime
& wxDateTime::operator-=(const wxDateSpan
& diff
)
1858 return Subtract(diff
);
1861 inline wxDateTime
& wxDateTime::operator+=(const wxDateSpan
& diff
)
1866 // ----------------------------------------------------------------------------
1867 // wxDateTime and timezones
1868 // ----------------------------------------------------------------------------
1871 wxDateTime::ToTimezone(const wxDateTime::TimeZone
& tz
, bool noDST
) const
1873 MODIFY_AND_RETURN( MakeTimezone(tz
, noDST
) );
1877 wxDateTime::FromTimezone(const wxDateTime::TimeZone
& tz
, bool noDST
) const
1879 MODIFY_AND_RETURN( MakeFromTimezone(tz
, noDST
) );
1882 // ----------------------------------------------------------------------------
1883 // wxTimeSpan construction
1884 // ----------------------------------------------------------------------------
1886 inline wxTimeSpan::wxTimeSpan(long hours
,
1891 // assign first to avoid precision loss
1898 m_diff
+= milliseconds
;
1901 // ----------------------------------------------------------------------------
1902 // wxTimeSpan accessors
1903 // ----------------------------------------------------------------------------
1905 inline wxLongLong
wxTimeSpan::GetSeconds() const
1907 return m_diff
/ 1000l;
1910 inline int wxTimeSpan::GetMinutes() const
1912 return (GetSeconds() / 60l).GetLo();
1915 inline int wxTimeSpan::GetHours() const
1917 return GetMinutes() / 60;
1920 inline int wxTimeSpan::GetDays() const
1922 return GetHours() / 24;
1925 inline int wxTimeSpan::GetWeeks() const
1927 return GetDays() / 7;
1930 // ----------------------------------------------------------------------------
1931 // wxTimeSpan arithmetics
1932 // ----------------------------------------------------------------------------
1934 inline wxTimeSpan
wxTimeSpan::Add(const wxTimeSpan
& diff
) const
1936 return wxTimeSpan(m_diff
+ diff
.GetValue());
1939 inline wxTimeSpan
& wxTimeSpan::Add(const wxTimeSpan
& diff
)
1941 m_diff
+= diff
.GetValue();
1946 inline wxTimeSpan
wxTimeSpan::Subtract(const wxTimeSpan
& diff
) const
1948 return wxTimeSpan(m_diff
- diff
.GetValue());
1951 inline wxTimeSpan
& wxTimeSpan::Subtract(const wxTimeSpan
& diff
)
1953 m_diff
-= diff
.GetValue();
1958 inline wxTimeSpan
& wxTimeSpan::Multiply(int n
)
1965 inline wxTimeSpan
wxTimeSpan::Multiply(int n
) const
1967 return wxTimeSpan(m_diff
* (long)n
);
1970 inline wxTimeSpan
wxTimeSpan::Abs() const
1972 return wxTimeSpan(GetValue().Abs());
1975 inline bool wxTimeSpan::IsEqualTo(const wxTimeSpan
& ts
) const
1977 return GetValue() == ts
.GetValue();
1980 inline bool wxTimeSpan::IsLongerThan(const wxTimeSpan
& ts
) const
1982 return GetValue().Abs() > ts
.GetValue().Abs();
1985 // ----------------------------------------------------------------------------
1987 // ----------------------------------------------------------------------------
1989 inline wxDateSpan
& wxDateSpan::operator+=(const wxDateSpan
& other
)
1991 m_years
+= other
.m_years
;
1992 m_months
+= other
.m_months
;
1993 m_weeks
+= other
.m_weeks
;
1994 m_days
+= other
.m_days
;
1999 inline wxDateSpan
& wxDateSpan::Add(const wxDateSpan
& other
)
2001 return *this += other
;
2004 inline wxDateSpan
wxDateSpan::Add(const wxDateSpan
& other
) const
2006 wxDateSpan
ds(*this);
2011 inline wxDateSpan
& wxDateSpan::Multiply(int factor
)
2021 inline wxDateSpan
wxDateSpan::Multiply(int factor
) const
2023 wxDateSpan
ds(*this);
2024 ds
.Multiply(factor
);
2028 inline wxDateSpan
wxDateSpan::Negate() const
2030 return wxDateSpan(-m_years
, -m_months
, -m_weeks
, -m_days
);
2033 inline wxDateSpan
& wxDateSpan::Neg()
2036 m_months
= -m_months
;
2043 inline wxDateSpan
& wxDateSpan::operator-=(const wxDateSpan
& other
)
2045 return *this += other
.Negate();
2048 inline wxDateSpan
& wxDateSpan::Subtract(const wxDateSpan
& other
)
2050 return *this -= other
;
2053 inline wxDateSpan
wxDateSpan::Subtract(const wxDateSpan
& other
) const
2055 wxDateSpan
ds(*this);
2060 #undef MILLISECONDS_PER_DAY
2062 #undef MODIFY_AND_RETURN
2064 // ============================================================================
2066 // ============================================================================
2068 // ----------------------------------------------------------------------------
2069 // wxTimeSpan operators
2070 // ----------------------------------------------------------------------------
2072 wxTimeSpan WXDLLIMPEXP_BASE
operator*(int n
, const wxTimeSpan
& ts
);
2074 // ----------------------------------------------------------------------------
2076 // ----------------------------------------------------------------------------
2078 wxDateSpan WXDLLIMPEXP_BASE
operator*(int n
, const wxDateSpan
& ds
);
2080 // ============================================================================
2081 // other helper functions
2082 // ============================================================================
2084 // ----------------------------------------------------------------------------
2085 // iteration helpers: can be used to write a for loop over enum variable like
2087 // for ( m = wxDateTime::Jan; m < wxDateTime::Inv_Month; wxNextMonth(m) )
2088 // ----------------------------------------------------------------------------
2090 WXDLLIMPEXP_BASE
void wxNextMonth(wxDateTime::Month
& m
);
2091 WXDLLIMPEXP_BASE
void wxPrevMonth(wxDateTime::Month
& m
);
2092 WXDLLIMPEXP_BASE
void wxNextWDay(wxDateTime::WeekDay
& wd
);
2093 WXDLLIMPEXP_BASE
void wxPrevWDay(wxDateTime::WeekDay
& wd
);
2095 #endif // wxUSE_DATETIME
2097 #endif // _WX_DATETIME_H