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
16 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
17 #pragma interface "datetime.h"
27 #include "wx/msw/wince/time.h"
30 #include <limits.h> // for INT_MIN
32 #include "wx/longlong.h"
34 class WXDLLIMPEXP_BASE wxDateTime
;
35 class WXDLLIMPEXP_BASE wxTimeSpan
;
36 class WXDLLIMPEXP_BASE wxDateSpan
;
38 #include "wx/dynarray.h"
40 // not all c-runtimes are based on 1/1/1970 being (time_t) 0
41 // set this to the corresponding value in seconds 1/1/1970 has on your
44 #if defined(__WXMAC__) && !defined(__DARWIN__) && __MSL__ < 0x6000
45 #define WX_TIME_BASE_OFFSET ( 2082844800L + 126144000L )
47 #define WX_TIME_BASE_OFFSET 0
52 * + 1. Time zones with minutes (make TimeZone a class)
53 * ? 2. getdate() function like under Solaris
54 * + 3. text conversion for wxDateSpan
55 * + 4. pluggable modules for the workdays calculations
56 * 5. wxDateTimeHolidayAuthority for Easter and other christian feasts
60 The three (main) classes declared in this header represent:
62 1. An absolute moment in the time (wxDateTime)
63 2. A difference between two moments in the time, positive or negative
65 3. A logical difference between two dates expressed in
66 years/months/weeks/days (wxDateSpan)
68 The following arithmetic operations are permitted (all others are not):
73 wxDateTime + wxTimeSpan = wxDateTime
74 wxDateTime + wxDateSpan = wxDateTime
75 wxTimeSpan + wxTimeSpan = wxTimeSpan
76 wxDateSpan + wxDateSpan = wxDateSpan
80 wxDateTime - wxDateTime = wxTimeSpan
81 wxDateTime - wxTimeSpan = wxDateTime
82 wxDateTime - wxDateSpan = wxDateTime
83 wxTimeSpan - wxTimeSpan = wxTimeSpan
84 wxDateSpan - wxDateSpan = wxDateSpan
88 wxTimeSpan * number = wxTimeSpan
89 number * wxTimeSpan = wxTimeSpan
90 wxDateSpan * number = wxDateSpan
91 number * wxDateSpan = wxDateSpan
95 -wxTimeSpan = wxTimeSpan
96 -wxDateSpan = wxDateSpan
98 For each binary operation OP (+, -, *) we have the following operatorOP=() as
99 a method and the method with a symbolic name OPER (Add, Subtract, Multiply)
100 as a synonym for it and another const method with the same name which returns
101 the changed copy of the object and operatorOP() as a global function which is
102 implemented in terms of the const version of OPEN. For the unary - we have
103 operator-() as a method, Neg() as synonym for it and Negate() which returns
104 the copy of the object with the changed sign.
107 // an invalid/default date time object which may be used as the default
108 // argument for arguments of type wxDateTime; it is also returned by all
109 // functions returning wxDateTime on failure (this is why it is also called
110 // wxInvalidDateTime)
111 class WXDLLIMPEXP_BASE wxDateTime
;
113 extern WXDLLIMPEXP_DATA_BASE(const wxChar
*) wxDefaultDateTimeFormat
;
114 extern WXDLLIMPEXP_DATA_BASE(const wxChar
*) wxDefaultTimeSpanFormat
;
115 extern WXDLLIMPEXP_DATA_BASE(const wxDateTime
) wxDefaultDateTime
;
117 #define wxInvalidDateTime wxDefaultDateTime
119 // ----------------------------------------------------------------------------
120 // wxDateTime represents an absolute moment in the time
121 // ----------------------------------------------------------------------------
123 class WXDLLIMPEXP_BASE wxDateTime
127 // ------------------------------------------------------------------------
129 // a small unsigned integer type for storing things like minutes,
130 // seconds &c. It should be at least short (i.e. not char) to contain
131 // the number of milliseconds - it may also be 'int' because there is
132 // no size penalty associated with it in our code, we don't store any
133 // data in this format
134 typedef unsigned short wxDateTime_t
;
137 // ------------------------------------------------------------------------
142 // the time in the current time zone
145 // zones from GMT (= Greenwhich Mean Time): they're guaranteed to be
146 // consequent numbers, so writing something like `GMT0 + offset' is
147 // safe if abs(offset) <= 12
149 // underscore stands for minus
150 GMT_12
, GMT_11
, GMT_10
, GMT_9
, GMT_8
, GMT_7
,
151 GMT_6
, GMT_5
, GMT_4
, GMT_3
, GMT_2
, GMT_1
,
153 GMT1
, GMT2
, GMT3
, GMT4
, GMT5
, GMT6
,
154 GMT7
, GMT8
, GMT9
, GMT10
, GMT11
, GMT12
,
155 // Note that GMT12 and GMT_12 are not the same: there is a difference
156 // of exactly one day between them
158 // some symbolic names for TZ
161 WET
= GMT0
, // Western Europe Time
162 WEST
= GMT1
, // Western Europe Summer Time
163 CET
= GMT1
, // Central Europe Time
164 CEST
= GMT2
, // Central Europe Summer Time
165 EET
= GMT2
, // Eastern Europe Time
166 EEST
= GMT3
, // Eastern Europe Summer Time
167 MSK
= GMT3
, // Moscow Time
168 MSD
= GMT4
, // Moscow Summer Time
171 AST
= GMT_4
, // Atlantic Standard Time
172 ADT
= GMT_3
, // Atlantic Daylight Time
173 EST
= GMT_5
, // Eastern Standard Time
174 EDT
= GMT_4
, // Eastern Daylight Saving Time
175 CST
= GMT_6
, // Central Standard Time
176 CDT
= GMT_5
, // Central Daylight Saving Time
177 MST
= GMT_7
, // Mountain Standard Time
178 MDT
= GMT_6
, // Mountain Daylight Saving Time
179 PST
= GMT_8
, // Pacific Standard Time
180 PDT
= GMT_7
, // Pacific Daylight Saving Time
181 HST
= GMT_10
, // Hawaiian Standard Time
182 AKST
= GMT_9
, // Alaska Standard Time
183 AKDT
= GMT_8
, // Alaska Daylight Saving Time
187 A_WST
= GMT8
, // Western Standard Time
188 A_CST
= GMT12
+ 1, // Central Standard Time (+9.5)
189 A_EST
= GMT10
, // Eastern Standard Time
190 A_ESST
= GMT11
, // Eastern Summer Time
192 // TODO add more symbolic timezone names here
194 // Universal Coordinated Time = the new and politically correct name
199 // the calendar systems we know about: notice that it's valid (for
200 // this classes purpose anyhow) to work with any of these calendars
201 // even with the dates before the historical appearance of the
205 Gregorian
, // current calendar
206 Julian
// calendar in use since -45 until the 1582 (or later)
208 // TODO Hebrew, Chinese, Maya, ... (just kidding) (or then may be not?)
211 // these values only are used to identify the different dates of
212 // adoption of the Gregorian calendar (see IsGregorian())
214 // All data and comments taken verbatim from "The Calendar FAQ (v 2.0)"
215 // by Claus Tøndering, http://www.pip.dknet.dk/~c-t/calendar.html
216 // except for the comments "we take".
218 // Symbol "->" should be read as "was followed by" in the comments
220 enum GregorianAdoption
222 Gr_Unknown
, // no data for this country or it's too uncertain to use
223 Gr_Standard
, // on the day 0 of Gregorian calendar: 15 Oct 1582
225 Gr_Alaska
, // Oct 1867 when Alaska became part of the USA
226 Gr_Albania
, // Dec 1912
228 Gr_Austria
= Gr_Unknown
, // Different regions on different dates
229 Gr_Austria_Brixen
, // 5 Oct 1583 -> 16 Oct 1583
230 Gr_Austria_Salzburg
= Gr_Austria_Brixen
,
231 Gr_Austria_Tyrol
= Gr_Austria_Brixen
,
232 Gr_Austria_Carinthia
, // 14 Dec 1583 -> 25 Dec 1583
233 Gr_Austria_Styria
= Gr_Austria_Carinthia
,
235 Gr_Belgium
, // Then part of the Netherlands
237 Gr_Bulgaria
= Gr_Unknown
, // Unknown precisely (from 1915 to 1920)
238 Gr_Bulgaria_1
, // 18 Mar 1916 -> 1 Apr 1916
239 Gr_Bulgaria_2
, // 31 Mar 1916 -> 14 Apr 1916
240 Gr_Bulgaria_3
, // 3 Sep 1920 -> 17 Sep 1920
242 Gr_Canada
= Gr_Unknown
, // Different regions followed the changes in
243 // Great Britain or France
245 Gr_China
= Gr_Unknown
, // Different authorities say:
246 Gr_China_1
, // 18 Dec 1911 -> 1 Jan 1912
247 Gr_China_2
, // 18 Dec 1928 -> 1 Jan 1929
249 Gr_Czechoslovakia
, // (Bohemia and Moravia) 6 Jan 1584 -> 17 Jan 1584
250 Gr_Denmark
, // (including Norway) 18 Feb 1700 -> 1 Mar 1700
253 Gr_Finland
, // Then part of Sweden
255 Gr_France
, // 9 Dec 1582 -> 20 Dec 1582
256 Gr_France_Alsace
, // 4 Feb 1682 -> 16 Feb 1682
257 Gr_France_Lorraine
, // 16 Feb 1760 -> 28 Feb 1760
258 Gr_France_Strasbourg
, // February 1682
260 Gr_Germany
= Gr_Unknown
, // Different states on different dates:
261 Gr_Germany_Catholic
, // 1583-1585 (we take 1584)
262 Gr_Germany_Prussia
, // 22 Aug 1610 -> 2 Sep 1610
263 Gr_Germany_Protestant
, // 18 Feb 1700 -> 1 Mar 1700
265 Gr_GreatBritain
, // 2 Sep 1752 -> 14 Sep 1752 (use 'cal(1)')
267 Gr_Greece
, // 9 Mar 1924 -> 23 Mar 1924
268 Gr_Hungary
, // 21 Oct 1587 -> 1 Nov 1587
269 Gr_Ireland
= Gr_GreatBritain
,
270 Gr_Italy
= Gr_Standard
,
272 Gr_Japan
= Gr_Unknown
, // Different authorities say:
273 Gr_Japan_1
, // 19 Dec 1872 -> 1 Jan 1873
274 Gr_Japan_2
, // 19 Dec 1892 -> 1 Jan 1893
275 Gr_Japan_3
, // 18 Dec 1918 -> 1 Jan 1919
277 Gr_Latvia
, // 1915-1918 (we take 1915)
278 Gr_Lithuania
, // 1915
279 Gr_Luxemburg
, // 14 Dec 1582 -> 25 Dec 1582
280 Gr_Netherlands
= Gr_Belgium
, // (including Belgium) 1 Jan 1583
282 // this is too weird to take into account: the Gregorian calendar was
283 // introduced twice in Groningen, first time 28 Feb 1583 was followed
284 // by 11 Mar 1583, then it has gone back to Julian in the summer of
285 // 1584 and then 13 Dec 1700 -> 12 Jan 1701 - which is
286 // the date we take here
287 Gr_Netherlands_Groningen
, // 13 Dec 1700 -> 12 Jan 1701
288 Gr_Netherlands_Gelderland
, // 30 Jun 1700 -> 12 Jul 1700
289 Gr_Netherlands_Utrecht
, // (and Overijssel) 30 Nov 1700->12 Dec 1700
290 Gr_Netherlands_Friesland
, // (and Drenthe) 31 Dec 1700 -> 12 Jan 1701
292 Gr_Norway
= Gr_Denmark
, // Then part of Denmark
293 Gr_Poland
= Gr_Standard
,
294 Gr_Portugal
= Gr_Standard
,
295 Gr_Romania
, // 31 Mar 1919 -> 14 Apr 1919
296 Gr_Russia
, // 31 Jan 1918 -> 14 Feb 1918
297 Gr_Scotland
= Gr_GreatBritain
,
298 Gr_Spain
= Gr_Standard
,
300 // Sweden has a curious history. Sweden decided to make a gradual
301 // change from the Julian to the Gregorian calendar. By dropping every
302 // leap year from 1700 through 1740 the eleven superfluous days would
303 // be omitted and from 1 Mar 1740 they would be in sync with the
304 // Gregorian calendar. (But in the meantime they would be in sync with
307 // So 1700 (which should have been a leap year in the Julian calendar)
308 // was not a leap year in Sweden. However, by mistake 1704 and 1708
309 // became leap years. This left Sweden out of synchronisation with
310 // both the Julian and the Gregorian world, so they decided to go back
311 // to the Julian calendar. In order to do this, they inserted an extra
312 // day in 1712, making that year a double leap year! So in 1712,
313 // February had 30 days in Sweden.
315 // Later, in 1753, Sweden changed to the Gregorian calendar by
316 // dropping 11 days like everyone else.
317 Gr_Sweden
= Gr_Finland
, // 17 Feb 1753 -> 1 Mar 1753
319 Gr_Switzerland
= Gr_Unknown
,// Different cantons used different dates
320 Gr_Switzerland_Catholic
, // 1583, 1584 or 1597 (we take 1584)
321 Gr_Switzerland_Protestant
, // 31 Dec 1700 -> 12 Jan 1701
323 Gr_Turkey
, // 1 Jan 1927
324 Gr_USA
= Gr_GreatBritain
,
325 Gr_Wales
= Gr_GreatBritain
,
326 Gr_Yugoslavia
// 1919
329 // the country parameter is used so far for calculating the start and
330 // the end of DST period and for deciding whether the date is a work
333 // TODO move this to intl.h
335 // Required for WinCE
342 Country_Unknown
, // no special information for this country
343 Country_Default
, // set the default country with SetCountry() method
344 // or use the default country with any other
346 // TODO add more countries (for this we must know about DST and/or
347 // holidays for this country)
349 // Western European countries: we assume that they all follow the same
350 // DST rules (true or false?)
351 Country_WesternEurope_Start
,
352 Country_EEC
= Country_WesternEurope_Start
,
356 Country_WesternEurope_End
= UK
,
361 // symbolic names for the months
364 Jan
, Feb
, Mar
, Apr
, May
, Jun
, Jul
, Aug
, Sep
, Oct
, Nov
, Dec
, Inv_Month
367 // symbolic names for the weekdays
370 Sun
, Mon
, Tue
, Wed
, Thu
, Fri
, Sat
, Inv_WeekDay
373 // invalid value for the year
376 Inv_Year
= SHRT_MIN
// should hold in wxDateTime_t
379 // flags for GetWeekDayName and GetMonthName
382 Name_Full
= 0x01, // return full name
383 Name_Abbr
= 0x02 // return abbreviated name
386 // flags for GetWeekOfYear and GetWeekOfMonth
389 Default_First
, // Sunday_First for US, Monday_First for the rest
390 Monday_First
, // week starts with a Monday
391 Sunday_First
// week starts with a Sunday
395 // ------------------------------------------------------------------------
397 // a class representing a time zone: basicly, this is just an offset
398 // (in seconds) from GMT
399 class WXDLLIMPEXP_BASE TimeZone
403 TimeZone(wxDateTime_t offset
= 0) { m_offset
= offset
; }
405 long GetOffset() const { return m_offset
; }
408 // offset for this timezone from GMT in seconds
412 // standard struct tm is limited to the years from 1900 (because
413 // tm_year field is the offset from 1900), so we use our own struct
414 // instead to represent broken down time
416 // NB: this struct should always be kept normalized (i.e. mon should
417 // be < 12, 1 <= day <= 31 &c), so use AddMonths(), AddDays()
418 // instead of modifying the member fields directly!
419 struct WXDLLIMPEXP_BASE Tm
421 wxDateTime_t msec
, sec
, min
, hour
, mday
;
425 // default ctor inits the object to an invalid value
428 // ctor from struct tm and the timezone
429 Tm(const struct tm
& tm
, const TimeZone
& tz
);
431 // check that the given date/time is valid (in Gregorian calendar)
432 bool IsValid() const;
435 WeekDay
GetWeekDay() // not const because wday may be changed
437 if ( wday
== Inv_WeekDay
)
440 return (WeekDay
)wday
;
443 // add the given number of months to the date keeping it normalized
444 void AddMonths(int monDiff
);
446 // add the given number of months to the date keeping it normalized
447 void AddDays(int dayDiff
);
450 // compute the weekday from other fields
451 void ComputeWeekDay();
453 // the timezone we correspond to
456 // these values can't be accessed directly because they're not always
457 // computed and we calculate them on demand
458 wxDateTime_t wday
, yday
;
462 // ------------------------------------------------------------------------
464 // set the current country
465 static void SetCountry(Country country
);
466 // get the current country
467 static Country
GetCountry();
469 // return true if the country is a West European one (in practice,
470 // this means that the same DST rules as for EEC apply)
471 static bool IsWestEuropeanCountry(Country country
= Country_Default
);
473 // return the current year
474 static int GetCurrentYear(Calendar cal
= Gregorian
);
476 // convert the year as returned by wxDateTime::GetYear() to a year
477 // suitable for BC/AD notation. The difference is that BC year 1
478 // corresponds to the year 0 (while BC year 0 didn't exist) and AD
479 // year N is just year N.
480 static int ConvertYearToBC(int year
);
482 // return the current month
483 static Month
GetCurrentMonth(Calendar cal
= Gregorian
);
485 // returns true if the given year is a leap year in the given calendar
486 static bool IsLeapYear(int year
= Inv_Year
, Calendar cal
= Gregorian
);
488 // get the century (19 for 1999, 20 for 2000 and -5 for 492 BC)
489 static int GetCentury(int year
= Inv_Year
);
491 // returns the number of days in this year (356 or 355 for Gregorian
492 // calendar usually :-)
493 static wxDateTime_t
GetNumberOfDays(int year
, Calendar cal
= Gregorian
);
495 // get the number of the days in the given month (default value for
496 // the year means the current one)
497 static wxDateTime_t
GetNumberOfDays(Month month
,
499 Calendar cal
= Gregorian
);
501 // get the full (default) or abbreviated month name in the current
502 // locale, returns empty string on error
503 static wxString
GetMonthName(Month month
,
504 NameFlags flags
= Name_Full
);
506 // get the full (default) or abbreviated weekday name in the current
507 // locale, returns empty string on error
508 static wxString
GetWeekDayName(WeekDay weekday
,
509 NameFlags flags
= Name_Full
);
511 // get the AM and PM strings in the current locale (may be empty)
512 static void GetAmPmStrings(wxString
*am
, wxString
*pm
);
514 // return true if the given country uses DST for this year
515 static bool IsDSTApplicable(int year
= Inv_Year
,
516 Country country
= Country_Default
);
518 // get the beginning of DST for this year, will return invalid object
519 // if no DST applicable in this year. The default value of the
520 // parameter means to take the current year.
521 static wxDateTime
GetBeginDST(int year
= Inv_Year
,
522 Country country
= Country_Default
);
523 // get the end of DST for this year, will return invalid object
524 // if no DST applicable in this year. The default value of the
525 // parameter means to take the current year.
526 static wxDateTime
GetEndDST(int year
= Inv_Year
,
527 Country country
= Country_Default
);
529 // return the wxDateTime object for the current time
530 static inline wxDateTime
Now();
532 // return the wxDateTime object for the current time with millisecond
533 // precision (if available on this platform)
534 static wxDateTime
UNow();
536 // return the wxDateTime object for today midnight: i.e. as Now() but
537 // with time set to 0
538 static inline wxDateTime
Today();
540 // constructors: you should test whether the constructor succeeded with
541 // IsValid() function. The values Inv_Month and Inv_Year for the
542 // parameters mean take current month and/or year values.
543 // ------------------------------------------------------------------------
545 // default ctor does not initialize the object, use Set()!
546 wxDateTime() { m_time
= wxLongLong((long)ULONG_MAX
, ULONG_MAX
); }
548 // from time_t: seconds since the Epoch 00:00:00 UTC, Jan 1, 1970)
549 #if (!(defined(__VISAGECPP__) && __IBMCPP__ >= 400))
550 // VA C++ confuses this with wxDateTime(double jdn) thinking it is a duplicate declaration
551 inline wxDateTime(time_t timet
);
553 // from broken down time/date (only for standard Unix range)
554 inline wxDateTime(const struct tm
& tm
);
555 // from broken down time/date (any range)
556 inline wxDateTime(const Tm
& tm
);
558 // from JDN (beware of rounding errors)
559 inline wxDateTime(double jdn
);
561 // from separate values for each component, date set to today
562 inline wxDateTime(wxDateTime_t hour
,
563 wxDateTime_t minute
= 0,
564 wxDateTime_t second
= 0,
565 wxDateTime_t millisec
= 0);
566 // from separate values for each component with explicit date
567 inline wxDateTime(wxDateTime_t day
, // day of the month
569 int year
= Inv_Year
, // 1999, not 99 please!
570 wxDateTime_t hour
= 0,
571 wxDateTime_t minute
= 0,
572 wxDateTime_t second
= 0,
573 wxDateTime_t millisec
= 0);
575 // default copy ctor ok
579 // assignment operators and Set() functions: all non const methods return
580 // the reference to this object. IsValid() should be used to test whether
581 // the function succeeded.
582 // ------------------------------------------------------------------------
584 // set to the current time
585 inline wxDateTime
& SetToCurrent();
587 #if (!(defined(__VISAGECPP__) && __IBMCPP__ >= 400))
588 // VA C++ confuses this with wxDateTime(double jdn) thinking it is a duplicate declaration
589 // set to given time_t value
590 inline wxDateTime
& Set(time_t timet
);
593 // set to given broken down time/date
594 wxDateTime
& Set(const struct tm
& tm
);
596 // set to given broken down time/date
597 inline wxDateTime
& Set(const Tm
& tm
);
599 // set to given JDN (beware of rounding errors)
600 wxDateTime
& Set(double jdn
);
602 // set to given time, date = today
603 wxDateTime
& Set(wxDateTime_t hour
,
604 wxDateTime_t minute
= 0,
605 wxDateTime_t second
= 0,
606 wxDateTime_t millisec
= 0);
608 // from separate values for each component with explicit date
609 // (defaults for month and year are the current values)
610 wxDateTime
& Set(wxDateTime_t day
,
612 int year
= Inv_Year
, // 1999, not 99 please!
613 wxDateTime_t hour
= 0,
614 wxDateTime_t minute
= 0,
615 wxDateTime_t second
= 0,
616 wxDateTime_t millisec
= 0);
618 // resets time to 00:00:00, doesn't change the date
619 wxDateTime
& ResetTime();
621 // the following functions don't change the values of the other
622 // fields, i.e. SetMinute() won't change either hour or seconds value
625 wxDateTime
& SetYear(int year
);
627 wxDateTime
& SetMonth(Month month
);
628 // set the day of the month
629 wxDateTime
& SetDay(wxDateTime_t day
);
631 wxDateTime
& SetHour(wxDateTime_t hour
);
633 wxDateTime
& SetMinute(wxDateTime_t minute
);
635 wxDateTime
& SetSecond(wxDateTime_t second
);
637 wxDateTime
& SetMillisecond(wxDateTime_t millisecond
);
639 // assignment operator from time_t
640 wxDateTime
& operator=(time_t timet
) { return Set(timet
); }
642 // assignment operator from broken down time/date
643 wxDateTime
& operator=(const struct tm
& tm
) { return Set(tm
); }
645 // assignment operator from broken down time/date
646 wxDateTime
& operator=(const Tm
& tm
) { return Set(tm
); }
648 // default assignment operator is ok
650 // calendar calculations (functions which set the date only leave the time
651 // unchanged, e.g. don't explictly zero it): SetXXX() functions modify the
652 // object itself, GetXXX() ones return a new object.
653 // ------------------------------------------------------------------------
655 // set to the given week day in the same week as this one
656 wxDateTime
& SetToWeekDayInSameWeek(WeekDay weekday
,
657 WeekFlags flags
= Monday_First
);
658 inline wxDateTime
GetWeekDayInSameWeek(WeekDay weekday
,
659 WeekFlags flags
= Monday_First
) const;
661 // set to the next week day following this one
662 wxDateTime
& SetToNextWeekDay(WeekDay weekday
);
663 inline wxDateTime
GetNextWeekDay(WeekDay weekday
) const;
665 // set to the previous week day before this one
666 wxDateTime
& SetToPrevWeekDay(WeekDay weekday
);
667 inline wxDateTime
GetPrevWeekDay(WeekDay weekday
) const;
669 // set to Nth occurence of given weekday in the given month of the
670 // given year (time is set to 0), return true on success and false on
671 // failure. n may be positive (1..5) or negative to count from the end
672 // of the month (see helper function SetToLastWeekDay())
673 bool SetToWeekDay(WeekDay weekday
,
675 Month month
= Inv_Month
,
676 int year
= Inv_Year
);
677 inline wxDateTime
GetWeekDay(WeekDay weekday
,
679 Month month
= Inv_Month
,
680 int year
= Inv_Year
) const;
682 // sets to the last weekday in the given month, year
683 inline bool SetToLastWeekDay(WeekDay weekday
,
684 Month month
= Inv_Month
,
685 int year
= Inv_Year
);
686 inline wxDateTime
GetLastWeekDay(WeekDay weekday
,
687 Month month
= Inv_Month
,
688 int year
= Inv_Year
);
690 // sets the date to the given day of the given week in the year,
691 // returns true on success and false if given date doesn't exist (e.g.
694 // these functions are badly defined as they're not the reverse of
695 // GetWeekOfYear(), use SetToTheWeekOfYear() instead
696 wxDEPRECATED( bool SetToTheWeek(wxDateTime_t numWeek
,
697 WeekDay weekday
= Mon
,
698 WeekFlags flags
= Monday_First
) );
699 wxDEPRECATED( wxDateTime
GetWeek(wxDateTime_t numWeek
,
700 WeekDay weekday
= Mon
,
701 WeekFlags flags
= Monday_First
) const );
703 // returns the date corresponding to the given week day of the given
704 // week (in ISO notation) of the specified year
705 static wxDateTime
SetToWeekOfYear(int year
,
706 wxDateTime_t numWeek
,
707 WeekDay weekday
= Mon
);
709 // sets the date to the last day of the given (or current) month or the
710 // given (or current) year
711 wxDateTime
& SetToLastMonthDay(Month month
= Inv_Month
,
712 int year
= Inv_Year
);
713 inline wxDateTime
GetLastMonthDay(Month month
= Inv_Month
,
714 int year
= Inv_Year
) const;
716 // sets to the given year day (1..365 or 366)
717 wxDateTime
& SetToYearDay(wxDateTime_t yday
);
718 inline wxDateTime
GetYearDay(wxDateTime_t yday
) const;
720 // The definitions below were taken verbatim from
722 // http://www.capecod.net/~pbaum/date/date0.htm
724 // (Peter Baum's home page)
726 // definition: The Julian Day Number, Julian Day, or JD of a
727 // particular instant of time is the number of days and fractions of a
728 // day since 12 hours Universal Time (Greenwich mean noon) on January
729 // 1 of the year -4712, where the year is given in the Julian
730 // proleptic calendar. The idea of using this reference date was
731 // originally proposed by Joseph Scalizer in 1582 to count years but
732 // it was modified by 19th century astronomers to count days. One
733 // could have equivalently defined the reference time to be noon of
734 // November 24, -4713 if were understood that Gregorian calendar rules
735 // were applied. Julian days are Julian Day Numbers and are not to be
736 // confused with Julian dates.
738 // definition: The Rata Die number is a date specified as the number
739 // of days relative to a base date of December 31 of the year 0. Thus
740 // January 1 of the year 1 is Rata Die day 1.
742 // get the Julian Day number (the fractional part specifies the time of
743 // the day, related to noon - beware of rounding errors!)
744 double GetJulianDayNumber() const;
745 double GetJDN() const { return GetJulianDayNumber(); }
747 // get the Modified Julian Day number: it is equal to JDN - 2400000.5
748 // and so integral MJDs correspond to the midnights (and not noons).
749 // MJD 0 is Nov 17, 1858
750 double GetModifiedJulianDayNumber() const { return GetJDN() - 2400000.5; }
751 double GetMJD() const { return GetModifiedJulianDayNumber(); }
753 // get the Rata Die number
754 double GetRataDie() const;
756 // TODO algorithms for calculating some important dates, such as
757 // religious holidays (Easter...) or moon/solar eclipses? Some
758 // algorithms can be found in the calendar FAQ
761 // Timezone stuff: a wxDateTime object constructed using given
762 // day/month/year/hour/min/sec values is interpreted as this moment in
763 // local time. Using the functions below, it may be converted to another
764 // time zone (e.g., the Unix epoch is wxDateTime(1, Jan, 1970).ToGMT()).
766 // These functions try to handle DST internally, but there is no magical
767 // way to know all rules for it in all countries in the world, so if the
768 // program can handle it itself (or doesn't want to handle it at all for
769 // whatever reason), the DST handling can be disabled with noDST.
770 // ------------------------------------------------------------------------
772 // transform to any given timezone
773 inline wxDateTime
ToTimezone(const TimeZone
& tz
, bool noDST
= false) const;
774 wxDateTime
& MakeTimezone(const TimeZone
& tz
, bool noDST
= false);
776 #if wxABI_VERSION >= 20602
777 // interpret current value as being in another timezone and transform
779 inline wxDateTime
FromTimezone(const TimeZone
& tz
, bool noDST
= false) const;
780 wxDateTime
& MakeFromTimezone(const TimeZone
& tz
, bool noDST
= false);
781 #endif // ABI >= 2.6.2
783 // transform to/from GMT/UTC
784 wxDateTime
ToUTC(bool noDST
= false) const { return ToTimezone(UTC
, noDST
); }
785 wxDateTime
& MakeUTC(bool noDST
= false) { return MakeTimezone(UTC
, noDST
); }
787 wxDateTime
ToGMT(bool noDST
= false) const { return ToUTC(noDST
); }
788 wxDateTime
& MakeGMT(bool noDST
= false) { return MakeUTC(noDST
); }
790 #if wxABI_VERSION >= 20602
791 wxDateTime
FromUTC(bool noDST
= false) const
792 { return FromTimezone(UTC
, noDST
); }
793 wxDateTime
& MakeFromUTC(bool noDST
= false)
794 { return MakeFromTimezone(UTC
, noDST
); }
795 #endif // ABI >= 2.6.2
797 // is daylight savings time in effect at this moment according to the
798 // rules of the specified country?
800 // Return value is > 0 if DST is in effect, 0 if it is not and -1 if
801 // the information is not available (this is compatible with ANSI C)
802 int IsDST(Country country
= Country_Default
) const;
805 // accessors: many of them take the timezone parameter which indicates the
806 // timezone for which to make the calculations and the default value means
807 // to do it for the current timezone of this machine (even if the function
808 // only operates with the date it's necessary because a date may wrap as
809 // result of timezone shift)
810 // ------------------------------------------------------------------------
812 // is the date valid?
813 inline bool IsValid() const { return m_time
!= wxInvalidDateTime
.m_time
; }
815 // get the broken down date/time representation in the given timezone
817 // If you wish to get several time components (day, month and year),
818 // consider getting the whole Tm strcuture first and retrieving the
819 // value from it - this is much more efficient
820 Tm
GetTm(const TimeZone
& tz
= Local
) const;
822 // get the number of seconds since the Unix epoch - returns (time_t)-1
823 // if the value is out of range
824 inline time_t GetTicks() const;
826 // get the year (returns Inv_Year if date is invalid)
827 int GetYear(const TimeZone
& tz
= Local
) const
828 { return GetTm(tz
).year
; }
829 // get the month (Inv_Month if date is invalid)
830 Month
GetMonth(const TimeZone
& tz
= Local
) const
831 { return (Month
)GetTm(tz
).mon
; }
832 // get the month day (in 1..31 range, 0 if date is invalid)
833 wxDateTime_t
GetDay(const TimeZone
& tz
= Local
) const
834 { return GetTm(tz
).mday
; }
835 // get the day of the week (Inv_WeekDay if date is invalid)
836 WeekDay
GetWeekDay(const TimeZone
& tz
= Local
) const
837 { return GetTm(tz
).GetWeekDay(); }
838 // get the hour of the day
839 wxDateTime_t
GetHour(const TimeZone
& tz
= Local
) const
840 { return GetTm(tz
).hour
; }
842 wxDateTime_t
GetMinute(const TimeZone
& tz
= Local
) const
843 { return GetTm(tz
).min
; }
845 wxDateTime_t
GetSecond(const TimeZone
& tz
= Local
) const
846 { return GetTm(tz
).sec
; }
848 wxDateTime_t
GetMillisecond(const TimeZone
& tz
= Local
) const
849 { return GetTm(tz
).msec
; }
851 // get the day since the year start (1..366, 0 if date is invalid)
852 wxDateTime_t
GetDayOfYear(const TimeZone
& tz
= Local
) const;
853 // get the week number since the year start (1..52 or 53, 0 if date is
855 wxDateTime_t
GetWeekOfYear(WeekFlags flags
= Monday_First
,
856 const TimeZone
& tz
= Local
) const;
857 // get the week number since the month start (1..5, 0 if date is
859 wxDateTime_t
GetWeekOfMonth(WeekFlags flags
= Monday_First
,
860 const TimeZone
& tz
= Local
) const;
862 // is this date a work day? This depends on a country, of course,
863 // because the holidays are different in different countries
864 bool IsWorkDay(Country country
= Country_Default
) const;
866 // is this date later than Gregorian calendar introduction for the
867 // given country (see enum GregorianAdoption)?
869 // NB: this function shouldn't be considered as absolute authority in
870 // the matter. Besides, for some countries the exact date of
871 // adoption of the Gregorian calendar is simply unknown.
872 bool IsGregorianDate(GregorianAdoption country
= Gr_Standard
) const;
874 // dos date and time format
875 // ------------------------------------------------------------------------
877 // set from the DOS packed format
878 wxDateTime
& SetFromDOS(unsigned long ddt
);
880 // pack the date in DOS format
881 unsigned long GetAsDOS() const;
883 // comparison (see also functions below for operator versions)
884 // ------------------------------------------------------------------------
886 // returns true if the two moments are strictly identical
887 inline bool IsEqualTo(const wxDateTime
& datetime
) const;
889 // returns true if the date is strictly earlier than the given one
890 inline bool IsEarlierThan(const wxDateTime
& datetime
) const;
892 // returns true if the date is strictly later than the given one
893 inline bool IsLaterThan(const wxDateTime
& datetime
) const;
895 // returns true if the date is strictly in the given range
896 inline bool IsStrictlyBetween(const wxDateTime
& t1
,
897 const wxDateTime
& t2
) const;
899 // returns true if the date is in the given range
900 inline bool IsBetween(const wxDateTime
& t1
, const wxDateTime
& t2
) const;
902 // do these two objects refer to the same date?
903 inline bool IsSameDate(const wxDateTime
& dt
) const;
905 // do these two objects have the same time?
906 inline bool IsSameTime(const wxDateTime
& dt
) const;
908 // are these two objects equal up to given timespan?
909 inline bool IsEqualUpTo(const wxDateTime
& dt
, const wxTimeSpan
& ts
) const;
911 inline bool operator<(const wxDateTime
& dt
) const
913 wxASSERT_MSG( IsValid() && dt
.IsValid(), _T("invalid wxDateTime") );
914 return GetValue() < dt
.GetValue();
917 inline bool operator<=(const wxDateTime
& dt
) const
919 wxASSERT_MSG( IsValid() && dt
.IsValid(), _T("invalid wxDateTime") );
920 return GetValue() <= dt
.GetValue();
923 inline bool operator>(const wxDateTime
& dt
) const
925 wxASSERT_MSG( IsValid() && dt
.IsValid(), _T("invalid wxDateTime") );
926 return GetValue() > dt
.GetValue();
929 inline bool operator>=(const wxDateTime
& dt
) const
931 wxASSERT_MSG( IsValid() && dt
.IsValid(), _T("invalid wxDateTime") );
932 return GetValue() >= dt
.GetValue();
935 inline bool operator==(const wxDateTime
& dt
) const
937 wxASSERT_MSG( IsValid() && dt
.IsValid(), _T("invalid wxDateTime") );
938 return GetValue() == dt
.GetValue();
941 inline bool operator!=(const wxDateTime
& dt
) const
943 wxASSERT_MSG( IsValid() && dt
.IsValid(), _T("invalid wxDateTime") );
944 return GetValue() != dt
.GetValue();
947 // arithmetics with dates (see also below for more operators)
948 // ------------------------------------------------------------------------
950 // return the sum of the date with a time span (positive or negative)
951 inline wxDateTime
Add(const wxTimeSpan
& diff
) const;
952 // add a time span (positive or negative)
953 inline wxDateTime
& Add(const wxTimeSpan
& diff
);
954 // add a time span (positive or negative)
955 inline wxDateTime
& operator+=(const wxTimeSpan
& diff
);
956 inline wxDateTime
operator+(const wxTimeSpan
& ts
) const
958 wxDateTime
dt(*this);
963 // return the difference of the date with a time span
964 inline wxDateTime
Subtract(const wxTimeSpan
& diff
) const;
965 // subtract a time span (positive or negative)
966 inline wxDateTime
& Subtract(const wxTimeSpan
& diff
);
967 // subtract a time span (positive or negative)
968 inline wxDateTime
& operator-=(const wxTimeSpan
& diff
);
969 inline wxDateTime
operator-(const wxTimeSpan
& ts
) const
971 wxDateTime
dt(*this);
976 // return the sum of the date with a date span
977 inline wxDateTime
Add(const wxDateSpan
& diff
) const;
978 // add a date span (positive or negative)
979 wxDateTime
& Add(const wxDateSpan
& diff
);
980 // add a date span (positive or negative)
981 inline wxDateTime
& operator+=(const wxDateSpan
& diff
);
982 inline wxDateTime
operator+(const wxDateSpan
& ds
) const
984 wxDateTime
dt(*this);
989 // return the difference of the date with a date span
990 inline wxDateTime
Subtract(const wxDateSpan
& diff
) const;
991 // subtract a date span (positive or negative)
992 inline wxDateTime
& Subtract(const wxDateSpan
& diff
);
993 // subtract a date span (positive or negative)
994 inline wxDateTime
& operator-=(const wxDateSpan
& diff
);
995 inline wxDateTime
operator-(const wxDateSpan
& ds
) const
997 wxDateTime
dt(*this);
1002 // return the difference between two dates
1003 inline wxTimeSpan
Subtract(const wxDateTime
& dt
) const;
1004 inline wxTimeSpan
operator-(const wxDateTime
& dt2
) const;
1006 // conversion to/from text: all conversions from text return the pointer to
1007 // the next character following the date specification (i.e. the one where
1008 // the scan had to stop) or NULL on failure.
1009 // ------------------------------------------------------------------------
1011 // parse a string in RFC 822 format (found e.g. in mail headers and
1012 // having the form "Wed, 10 Feb 1999 19:07:07 +0100")
1013 const wxChar
*ParseRfc822Date(const wxChar
* date
);
1014 // parse a date/time in the given format (see strptime(3)), fill in
1015 // the missing (in the string) fields with the values of dateDef (by
1016 // default, they will not change if they had valid values or will
1017 // default to Today() otherwise)
1018 const wxChar
*ParseFormat(const wxChar
*date
,
1019 const wxChar
*format
= wxDefaultDateTimeFormat
,
1020 const wxDateTime
& dateDef
= wxDefaultDateTime
);
1021 // parse a string containing the date/time in "free" format, this
1022 // function will try to make an educated guess at the string contents
1023 const wxChar
*ParseDateTime(const wxChar
*datetime
);
1024 // parse a string containing the date only in "free" format (less
1025 // flexible than ParseDateTime)
1026 const wxChar
*ParseDate(const wxChar
*date
);
1027 // parse a string containing the time only in "free" format
1028 const wxChar
*ParseTime(const wxChar
*time
);
1030 // this function accepts strftime()-like format string (default
1031 // argument corresponds to the preferred date and time representation
1032 // for the current locale) and returns the string containing the
1033 // resulting text representation
1034 wxString
Format(const wxChar
*format
= wxDefaultDateTimeFormat
,
1035 const TimeZone
& tz
= Local
) const;
1036 // preferred date representation for the current locale
1037 wxString
FormatDate() const { return Format(_T("%x")); }
1038 // preferred time representation for the current locale
1039 wxString
FormatTime() const { return Format(_T("%X")); }
1040 // returns the string representing the date in ISO 8601 format
1042 wxString
FormatISODate() const { return Format(_T("%Y-%m-%d")); }
1043 // returns the string representing the time in ISO 8601 format
1045 wxString
FormatISOTime() const { return Format(_T("%H:%M:%S")); }
1048 // ------------------------------------------------------------------------
1050 // construct from internal representation
1051 wxDateTime(const wxLongLong
& time
) { m_time
= time
; }
1053 // get the internal representation
1054 inline wxLongLong
GetValue() const;
1056 // a helper function to get the current time_t
1057 static time_t GetTimeNow() { return time((time_t *)NULL
); }
1059 // another one to get the current time broken down
1060 static struct tm
*GetTmNow()
1062 time_t t
= GetTimeNow();
1063 return localtime(&t
);
1067 // the current country - as it's the same for all program objects (unless
1068 // it runs on a _really_ big cluster system :-), this is a static member:
1069 // see SetCountry() and GetCountry()
1070 static Country ms_country
;
1072 // this constant is used to transform a time_t value to the internal
1073 // representation, as time_t is in seconds and we use milliseconds it's
1075 static const long TIME_T_FACTOR
;
1077 // returns true if we fall in range in which we can use standard ANSI C
1079 inline bool IsInStdRange() const;
1081 // the internal representation of the time is the amount of milliseconds
1082 // elapsed since the origin which is set by convention to the UNIX/C epoch
1083 // value: the midnight of January 1, 1970 (UTC)
1087 // ----------------------------------------------------------------------------
1088 // This class contains a difference between 2 wxDateTime values, so it makes
1089 // sense to add it to wxDateTime and it is the result of subtraction of 2
1090 // objects of that class. See also wxDateSpan.
1091 // ----------------------------------------------------------------------------
1093 class WXDLLIMPEXP_BASE wxTimeSpan
1097 // ------------------------------------------------------------------------
1099 // return the timespan for the given number of seconds
1100 static wxTimeSpan
Seconds(long sec
) { return wxTimeSpan(0, 0, sec
); }
1101 static wxTimeSpan
Second() { return Seconds(1); }
1103 // return the timespan for the given number of minutes
1104 static wxTimeSpan
Minutes(long min
) { return wxTimeSpan(0, min
, 0 ); }
1105 static wxTimeSpan
Minute() { return Minutes(1); }
1107 // return the timespan for the given number of hours
1108 static wxTimeSpan
Hours(long hours
) { return wxTimeSpan(hours
, 0, 0); }
1109 static wxTimeSpan
Hour() { return Hours(1); }
1111 // return the timespan for the given number of days
1112 static wxTimeSpan
Days(long days
) { return Hours(24 * days
); }
1113 static wxTimeSpan
Day() { return Days(1); }
1115 // return the timespan for the given number of weeks
1116 static wxTimeSpan
Weeks(long days
) { return Days(7 * days
); }
1117 static wxTimeSpan
Week() { return Weeks(1); }
1119 // default ctor constructs the 0 time span
1122 // from separate values for each component, date set to 0 (hours are
1123 // not restricted to 0..24 range, neither are minutes, seconds or
1125 inline wxTimeSpan(long hours
,
1128 long milliseconds
= 0);
1130 // default copy ctor is ok
1134 // arithmetics with time spans (see also below for more operators)
1135 // ------------------------------------------------------------------------
1137 // return the sum of two timespans
1138 inline wxTimeSpan
Add(const wxTimeSpan
& diff
) const;
1139 // add two timespans together
1140 inline wxTimeSpan
& Add(const wxTimeSpan
& diff
);
1141 // add two timespans together
1142 wxTimeSpan
& operator+=(const wxTimeSpan
& diff
) { return Add(diff
); }
1143 inline wxTimeSpan
operator+(const wxTimeSpan
& ts
) const
1145 return wxTimeSpan(GetValue() + ts
.GetValue());
1148 // return the difference of two timespans
1149 inline wxTimeSpan
Subtract(const wxTimeSpan
& diff
) const;
1150 // subtract another timespan
1151 inline wxTimeSpan
& Subtract(const wxTimeSpan
& diff
);
1152 // subtract another timespan
1153 wxTimeSpan
& operator-=(const wxTimeSpan
& diff
) { return Subtract(diff
); }
1154 inline wxTimeSpan
operator-(const wxTimeSpan
& ts
)
1156 return wxTimeSpan(GetValue() - ts
.GetValue());
1159 // multiply timespan by a scalar
1160 inline wxTimeSpan
Multiply(int n
) const;
1161 // multiply timespan by a scalar
1162 inline wxTimeSpan
& Multiply(int n
);
1163 // multiply timespan by a scalar
1164 wxTimeSpan
& operator*=(int n
) { return Multiply(n
); }
1165 inline wxTimeSpan
operator*(int n
) const
1167 return wxTimeSpan(*this).Multiply(n
);
1170 // return this timespan with opposite sign
1171 wxTimeSpan
Negate() const { return wxTimeSpan(-GetValue()); }
1172 // negate the value of the timespan
1173 wxTimeSpan
& Neg() { m_diff
= -GetValue(); return *this; }
1174 // negate the value of the timespan
1175 wxTimeSpan
& operator-() { return Neg(); }
1177 // return the absolute value of the timespan: does _not_ modify the
1179 inline wxTimeSpan
Abs() const;
1181 // there is intentionally no division because we don't want to
1182 // introduce rounding errors in time calculations
1184 // comparaison (see also operator versions below)
1185 // ------------------------------------------------------------------------
1187 // is the timespan null?
1188 bool IsNull() const { return m_diff
== 0l; }
1189 // returns true if the timespan is null
1190 bool operator!() const { return !IsNull(); }
1192 // is the timespan positive?
1193 bool IsPositive() const { return m_diff
> 0l; }
1195 // is the timespan negative?
1196 bool IsNegative() const { return m_diff
< 0l; }
1198 // are two timespans equal?
1199 inline bool IsEqualTo(const wxTimeSpan
& ts
) const;
1200 // compare two timestamps: works with the absolute values, i.e. -2
1201 // hours is longer than 1 hour. Also, it will return false if the
1202 // timespans are equal in absolute value.
1203 inline bool IsLongerThan(const wxTimeSpan
& ts
) const;
1204 // compare two timestamps: works with the absolute values, i.e. 1
1205 // hour is shorter than -2 hours. Also, it will return false if the
1206 // timespans are equal in absolute value.
1207 bool IsShorterThan(const wxTimeSpan
& t
) const { return !IsLongerThan(t
); }
1209 inline bool operator<(const wxTimeSpan
&ts
) const
1211 return GetValue() < ts
.GetValue();
1214 inline bool operator<=(const wxTimeSpan
&ts
) const
1216 return GetValue() <= ts
.GetValue();
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 // breaking into days, hours, minutes and seconds
1240 // ------------------------------------------------------------------------
1242 // get the max number of weeks in this timespan
1243 inline int GetWeeks() const;
1244 // get the max number of days in this timespan
1245 inline int GetDays() const;
1246 // get the max number of hours in this timespan
1247 inline int GetHours() const;
1248 // get the max number of minutes in this timespan
1249 inline int GetMinutes() const;
1250 // get the max number of seconds in this timespan
1251 inline wxLongLong
GetSeconds() const;
1252 // get the number of milliseconds in this timespan
1253 wxLongLong
GetMilliseconds() const { return m_diff
; }
1255 // conversion to text
1256 // ------------------------------------------------------------------------
1258 // this function accepts strftime()-like format string (default
1259 // argument corresponds to the preferred date and time representation
1260 // for the current locale) and returns the string containing the
1261 // resulting text representation. Notice that only some of format
1262 // specifiers valid for wxDateTime are valid for wxTimeSpan: hours,
1263 // minutes and seconds make sense, but not "PM/AM" string for example.
1264 wxString
Format(const wxChar
*format
= wxDefaultTimeSpanFormat
) const;
1267 // ------------------------------------------------------------------------
1269 // construct from internal representation
1270 wxTimeSpan(const wxLongLong
& diff
) { m_diff
= diff
; }
1272 // get the internal representation
1273 wxLongLong
GetValue() const { return m_diff
; }
1276 // the (signed) time span in milliseconds
1280 // ----------------------------------------------------------------------------
1281 // This class is a "logical time span" and is useful for implementing program
1282 // logic for such things as "add one month to the date" which, in general,
1283 // doesn't mean to add 60*60*24*31 seconds to it, but to take the same date
1284 // the next month (to understand that this is indeed different consider adding
1285 // one month to Feb, 15 - we want to get Mar, 15, of course).
1287 // When adding a month to the date, all lesser components (days, hours, ...)
1288 // won't be changed unless the resulting date would be invalid: for example,
1289 // Jan 31 + 1 month will be Feb 28, not (non existing) Feb 31.
1291 // Because of this feature, adding and subtracting back again the same
1292 // wxDateSpan will *not*, in general give back the original date: Feb 28 - 1
1293 // month will be Jan 28, not Jan 31!
1295 // wxDateSpan can be either positive or negative. They may be
1296 // multiplied by scalars which multiply all deltas by the scalar: i.e. 2*(1
1297 // month and 1 day) is 2 months and 2 days. They can be added together and
1298 // with wxDateTime or wxTimeSpan, but the type of result is different for each
1301 // Beware about weeks: if you specify both weeks and days, the total number of
1302 // days added will be 7*weeks + days! See also GetTotalDays() function.
1304 // Equality operators are defined for wxDateSpans. Two datespans are equal if
1305 // they both give the same target date when added to *every* source date.
1306 // Thus wxDateSpan::Months(1) is not equal to wxDateSpan::Days(30), because
1307 // they not give the same date when added to 1 Feb. But wxDateSpan::Days(14) is
1308 // equal to wxDateSpan::Weeks(2)
1310 // Finally, notice that for adding hours, minutes &c you don't need this
1311 // class: wxTimeSpan will do the job because there are no subtleties
1312 // associated with those.
1313 // ----------------------------------------------------------------------------
1315 class WXDLLIMPEXP_BASE wxDateSpan
1319 // ------------------------------------------------------------------------
1321 // this many years/months/weeks/days
1322 wxDateSpan(int years
= 0, int months
= 0, int weeks
= 0, int days
= 0)
1330 // get an object for the given number of days
1331 static wxDateSpan
Days(int days
) { return wxDateSpan(0, 0, 0, days
); }
1332 static wxDateSpan
Day() { return Days(1); }
1334 // get an object for the given number of weeks
1335 static wxDateSpan
Weeks(int weeks
) { return wxDateSpan(0, 0, weeks
, 0); }
1336 static wxDateSpan
Week() { return Weeks(1); }
1338 // get an object for the given number of months
1339 static wxDateSpan
Months(int mon
) { return wxDateSpan(0, mon
, 0, 0); }
1340 static wxDateSpan
Month() { return Months(1); }
1342 // get an object for the given number of years
1343 static wxDateSpan
Years(int years
) { return wxDateSpan(years
, 0, 0, 0); }
1344 static wxDateSpan
Year() { return Years(1); }
1346 // default copy ctor is ok
1350 // accessors (all SetXXX() return the (modified) wxDateSpan object)
1351 // ------------------------------------------------------------------------
1353 // set number of years
1354 wxDateSpan
& SetYears(int n
) { m_years
= n
; return *this; }
1355 // set number of months
1356 wxDateSpan
& SetMonths(int n
) { m_months
= n
; return *this; }
1357 // set number of weeks
1358 wxDateSpan
& SetWeeks(int n
) { m_weeks
= n
; return *this; }
1359 // set number of days
1360 wxDateSpan
& SetDays(int n
) { m_days
= n
; return *this; }
1362 // get number of years
1363 int GetYears() const { return m_years
; }
1364 // get number of months
1365 int GetMonths() const { return m_months
; }
1366 // get number of weeks
1367 int GetWeeks() const { return m_weeks
; }
1368 // get number of days
1369 int GetDays() const { return m_days
; }
1370 // returns 7*GetWeeks() + GetDays()
1371 int GetTotalDays() const { return 7*m_weeks
+ m_days
; }
1373 // arithmetics with date spans (see also below for more operators)
1374 // ------------------------------------------------------------------------
1376 // return sum of two date spans
1377 inline wxDateSpan
Add(const wxDateSpan
& other
) const;
1378 // add another wxDateSpan to us
1379 inline wxDateSpan
& Add(const wxDateSpan
& other
);
1380 // add another wxDateSpan to us
1381 inline wxDateSpan
& operator+=(const wxDateSpan
& other
);
1382 inline wxDateSpan
operator+(const wxDateSpan
& ds
) const
1384 return wxDateSpan(GetYears() + ds
.GetYears(),
1385 GetMonths() + ds
.GetMonths(),
1386 GetWeeks() + ds
.GetWeeks(),
1387 GetDays() + ds
.GetDays());
1390 // return difference of two date spans
1391 inline wxDateSpan
Subtract(const wxDateSpan
& other
) const;
1392 // subtract another wxDateSpan from us
1393 inline wxDateSpan
& Subtract(const wxDateSpan
& other
);
1394 // subtract another wxDateSpan from us
1395 inline wxDateSpan
& operator-=(const wxDateSpan
& other
);
1396 inline wxDateSpan
operator-(const wxDateSpan
& ds
) const
1398 return wxDateSpan(GetYears() - ds
.GetYears(),
1399 GetMonths() - ds
.GetMonths(),
1400 GetWeeks() - ds
.GetWeeks(),
1401 GetDays() - ds
.GetDays());
1404 // return a copy of this time span with changed sign
1405 inline wxDateSpan
Negate() const;
1406 // inverse the sign of this timespan
1407 inline wxDateSpan
& Neg();
1408 // inverse the sign of this timespan
1409 wxDateSpan
& operator-() { return Neg(); }
1411 // return the date span proportional to this one with given factor
1412 inline wxDateSpan
Multiply(int factor
) const;
1413 // multiply all components by a (signed) number
1414 inline wxDateSpan
& Multiply(int factor
);
1415 // multiply all components by a (signed) number
1416 inline wxDateSpan
& operator*=(int factor
) { return Multiply(factor
); }
1417 inline wxDateSpan
operator*(int n
) const
1419 return wxDateSpan(*this).Multiply(n
);
1422 // ds1 == d2 if and only if for every wxDateTime t t + ds1 == t + ds2
1423 inline bool operator==(const wxDateSpan
& ds
) const
1425 return GetYears() == ds
.GetYears() &&
1426 GetMonths() == ds
.GetMonths() &&
1427 GetTotalDays() == ds
.GetTotalDays();
1430 inline bool operator!=(const wxDateSpan
& ds
) const
1432 return !(*this == ds
);
1442 // ----------------------------------------------------------------------------
1443 // wxDateTimeArray: array of dates.
1444 // ----------------------------------------------------------------------------
1446 WX_DECLARE_USER_EXPORTED_OBJARRAY(wxDateTime
, wxDateTimeArray
, WXDLLIMPEXP_BASE
);
1448 // ----------------------------------------------------------------------------
1449 // wxDateTimeHolidayAuthority: an object of this class will decide whether a
1450 // given date is a holiday and is used by all functions working with "work
1453 // NB: the base class is an ABC, derived classes must implement the pure
1454 // virtual methods to work with the holidays they correspond to.
1455 // ----------------------------------------------------------------------------
1457 class WXDLLIMPEXP_BASE wxDateTimeHolidayAuthority
;
1458 WX_DEFINE_USER_EXPORTED_ARRAY_PTR(wxDateTimeHolidayAuthority
*,
1459 wxHolidayAuthoritiesArray
,
1460 class WXDLLIMPEXP_BASE
);
1462 class wxDateTimeHolidaysModule
;
1463 class WXDLLIMPEXP_BASE wxDateTimeHolidayAuthority
1465 friend class wxDateTimeHolidaysModule
;
1467 // returns true if the given date is a holiday
1468 static bool IsHoliday(const wxDateTime
& dt
);
1470 // fills the provided array with all holidays in the given range, returns
1471 // the number of them
1472 static size_t GetHolidaysInRange(const wxDateTime
& dtStart
,
1473 const wxDateTime
& dtEnd
,
1474 wxDateTimeArray
& holidays
);
1476 // clear the list of holiday authorities
1477 static void ClearAllAuthorities();
1479 // add a new holiday authority (the pointer will be deleted by
1480 // wxDateTimeHolidayAuthority)
1481 static void AddAuthority(wxDateTimeHolidayAuthority
*auth
);
1483 // the base class must have a virtual dtor
1484 virtual ~wxDateTimeHolidayAuthority();
1487 // this function is called to determine whether a given day is a holiday
1488 virtual bool DoIsHoliday(const wxDateTime
& dt
) const = 0;
1490 // this function should fill the array with all holidays between the two
1491 // given dates - it is implemented in the base class, but in a very
1492 // inefficient way (it just iterates over all days and uses IsHoliday() for
1493 // each of them), so it must be overridden in the derived class where the
1494 // base class version may be explicitly used if needed
1496 // returns the number of holidays in the given range and fills holidays
1498 virtual size_t DoGetHolidaysInRange(const wxDateTime
& dtStart
,
1499 const wxDateTime
& dtEnd
,
1500 wxDateTimeArray
& holidays
) const = 0;
1503 // all holiday authorities
1504 static wxHolidayAuthoritiesArray ms_authorities
;
1507 // the holidays for this class are all Saturdays and Sundays
1508 class WXDLLIMPEXP_BASE wxDateTimeWorkDays
: public wxDateTimeHolidayAuthority
1511 virtual bool DoIsHoliday(const wxDateTime
& dt
) const;
1512 virtual size_t DoGetHolidaysInRange(const wxDateTime
& dtStart
,
1513 const wxDateTime
& dtEnd
,
1514 wxDateTimeArray
& holidays
) const;
1517 // ============================================================================
1518 // inline functions implementation
1519 // ============================================================================
1521 // ----------------------------------------------------------------------------
1523 // ----------------------------------------------------------------------------
1525 #define MILLISECONDS_PER_DAY 86400000l
1527 // some broken compilers (HP-UX CC) refuse to compile the "normal" version, but
1528 // using a temp variable always might prevent other compilers from optimising
1529 // it away - hence use of this ugly macro
1531 #define MODIFY_AND_RETURN(op) return wxDateTime(*this).op
1533 #define MODIFY_AND_RETURN(op) wxDateTime dt(*this); dt.op; return dt
1536 // ----------------------------------------------------------------------------
1537 // wxDateTime construction
1538 // ----------------------------------------------------------------------------
1540 inline bool wxDateTime::IsInStdRange() const
1542 return m_time
>= 0l && (m_time
/ TIME_T_FACTOR
) < LONG_MAX
;
1546 inline wxDateTime
wxDateTime::Now()
1548 return wxDateTime(*GetTmNow());
1552 inline wxDateTime
wxDateTime::Today()
1554 wxDateTime
dt(Now());
1560 #if (!(defined(__VISAGECPP__) && __IBMCPP__ >= 400))
1561 inline wxDateTime
& wxDateTime::Set(time_t timet
)
1563 // assign first to avoid long multiplication overflow!
1564 m_time
= timet
- WX_TIME_BASE_OFFSET
;
1565 m_time
*= TIME_T_FACTOR
;
1571 inline wxDateTime
& wxDateTime::SetToCurrent()
1577 #if (!(defined(__VISAGECPP__) && __IBMCPP__ >= 400))
1578 inline wxDateTime::wxDateTime(time_t timet
)
1584 inline wxDateTime::wxDateTime(const struct tm
& tm
)
1589 inline wxDateTime::wxDateTime(const Tm
& tm
)
1594 inline wxDateTime::wxDateTime(double jdn
)
1599 inline wxDateTime
& wxDateTime::Set(const Tm
& tm
)
1601 wxASSERT_MSG( tm
.IsValid(), _T("invalid broken down date/time") );
1603 return Set(tm
.mday
, (Month
)tm
.mon
, tm
.year
,
1604 tm
.hour
, tm
.min
, tm
.sec
, tm
.msec
);
1607 inline wxDateTime::wxDateTime(wxDateTime_t hour
,
1608 wxDateTime_t minute
,
1609 wxDateTime_t second
,
1610 wxDateTime_t millisec
)
1612 Set(hour
, minute
, second
, millisec
);
1615 inline wxDateTime::wxDateTime(wxDateTime_t day
,
1619 wxDateTime_t minute
,
1620 wxDateTime_t second
,
1621 wxDateTime_t millisec
)
1623 Set(day
, month
, year
, hour
, minute
, second
, millisec
);
1626 // ----------------------------------------------------------------------------
1627 // wxDateTime accessors
1628 // ----------------------------------------------------------------------------
1630 inline wxLongLong
wxDateTime::GetValue() const
1632 wxASSERT_MSG( IsValid(), _T("invalid wxDateTime"));
1637 inline time_t wxDateTime::GetTicks() const
1639 wxASSERT_MSG( IsValid(), _T("invalid wxDateTime"));
1640 if ( !IsInStdRange() )
1645 return (time_t)((m_time
/ (long)TIME_T_FACTOR
).GetLo())+WX_TIME_BASE_OFFSET
;
1648 inline bool wxDateTime::SetToLastWeekDay(WeekDay weekday
,
1652 return SetToWeekDay(weekday
, -1, month
, year
);
1656 wxDateTime::GetWeekDayInSameWeek(WeekDay weekday
,
1657 WeekFlags
WXUNUSED(flags
)) const
1659 MODIFY_AND_RETURN( SetToWeekDayInSameWeek(weekday
) );
1662 inline wxDateTime
wxDateTime::GetNextWeekDay(WeekDay weekday
) const
1664 MODIFY_AND_RETURN( SetToNextWeekDay(weekday
) );
1667 inline wxDateTime
wxDateTime::GetPrevWeekDay(WeekDay weekday
) const
1669 MODIFY_AND_RETURN( SetToPrevWeekDay(weekday
) );
1672 inline wxDateTime
wxDateTime::GetWeekDay(WeekDay weekday
,
1677 wxDateTime
dt(*this);
1679 return dt
.SetToWeekDay(weekday
, n
, month
, year
) ? dt
: wxInvalidDateTime
;
1682 inline wxDateTime
wxDateTime::GetLastWeekDay(WeekDay weekday
,
1686 wxDateTime
dt(*this);
1688 return dt
.SetToLastWeekDay(weekday
, month
, year
) ? dt
: wxInvalidDateTime
;
1691 inline wxDateTime
wxDateTime::GetLastMonthDay(Month month
, int year
) const
1693 MODIFY_AND_RETURN( SetToLastMonthDay(month
, year
) );
1696 inline wxDateTime
wxDateTime::GetYearDay(wxDateTime_t yday
) const
1698 MODIFY_AND_RETURN( SetToYearDay(yday
) );
1701 // ----------------------------------------------------------------------------
1702 // wxDateTime comparison
1703 // ----------------------------------------------------------------------------
1705 inline bool wxDateTime::IsEqualTo(const wxDateTime
& datetime
) const
1707 wxASSERT_MSG( IsValid() && datetime
.IsValid(), _T("invalid wxDateTime"));
1709 return m_time
== datetime
.m_time
;
1712 inline bool wxDateTime::IsEarlierThan(const wxDateTime
& datetime
) const
1714 wxASSERT_MSG( IsValid() && datetime
.IsValid(), _T("invalid wxDateTime"));
1716 return m_time
< datetime
.m_time
;
1719 inline bool wxDateTime::IsLaterThan(const wxDateTime
& datetime
) const
1721 wxASSERT_MSG( IsValid() && datetime
.IsValid(), _T("invalid wxDateTime"));
1723 return m_time
> datetime
.m_time
;
1726 inline bool wxDateTime::IsStrictlyBetween(const wxDateTime
& t1
,
1727 const wxDateTime
& t2
) const
1729 // no need for assert, will be checked by the functions we call
1730 return IsLaterThan(t1
) && IsEarlierThan(t2
);
1733 inline bool wxDateTime::IsBetween(const wxDateTime
& t1
,
1734 const wxDateTime
& t2
) const
1736 // no need for assert, will be checked by the functions we call
1737 return IsEqualTo(t1
) || IsEqualTo(t2
) || IsStrictlyBetween(t1
, t2
);
1740 inline bool wxDateTime::IsSameDate(const wxDateTime
& dt
) const
1745 return tm1
.year
== tm2
.year
&&
1746 tm1
.mon
== tm2
.mon
&&
1747 tm1
.mday
== tm2
.mday
;
1750 inline bool wxDateTime::IsSameTime(const wxDateTime
& dt
) const
1752 // notice that we can't do something like this:
1754 // m_time % MILLISECONDS_PER_DAY == dt.m_time % MILLISECONDS_PER_DAY
1756 // because we have also to deal with (possibly) different DST settings!
1760 return tm1
.hour
== tm2
.hour
&&
1761 tm1
.min
== tm2
.min
&&
1762 tm1
.sec
== tm2
.sec
&&
1763 tm1
.msec
== tm2
.msec
;
1766 inline bool wxDateTime::IsEqualUpTo(const wxDateTime
& dt
,
1767 const wxTimeSpan
& ts
) const
1769 return IsBetween(dt
.Subtract(ts
), dt
.Add(ts
));
1772 // ----------------------------------------------------------------------------
1773 // wxDateTime arithmetics
1774 // ----------------------------------------------------------------------------
1776 inline wxDateTime
wxDateTime::Add(const wxTimeSpan
& diff
) const
1778 wxASSERT_MSG( IsValid(), _T("invalid wxDateTime"));
1780 return wxDateTime(m_time
+ diff
.GetValue());
1783 inline wxDateTime
& wxDateTime::Add(const wxTimeSpan
& diff
)
1785 wxASSERT_MSG( IsValid(), _T("invalid wxDateTime"));
1787 m_time
+= diff
.GetValue();
1792 inline wxDateTime
& wxDateTime::operator+=(const wxTimeSpan
& diff
)
1797 inline wxDateTime
wxDateTime::Subtract(const wxTimeSpan
& diff
) const
1799 wxASSERT_MSG( IsValid(), _T("invalid wxDateTime"));
1801 return wxDateTime(m_time
- diff
.GetValue());
1804 inline wxDateTime
& wxDateTime::Subtract(const wxTimeSpan
& diff
)
1806 wxASSERT_MSG( IsValid(), _T("invalid wxDateTime"));
1808 m_time
-= diff
.GetValue();
1813 inline wxDateTime
& wxDateTime::operator-=(const wxTimeSpan
& diff
)
1815 return Subtract(diff
);
1818 inline wxTimeSpan
wxDateTime::Subtract(const wxDateTime
& datetime
) const
1820 wxASSERT_MSG( IsValid() && datetime
.IsValid(), _T("invalid wxDateTime"));
1822 return wxTimeSpan(GetValue() - datetime
.GetValue());
1825 inline wxTimeSpan
wxDateTime::operator-(const wxDateTime
& dt2
) const
1827 return this->Subtract(dt2
);
1830 inline wxDateTime
wxDateTime::Add(const wxDateSpan
& diff
) const
1832 return wxDateTime(*this).Add(diff
);
1835 inline wxDateTime
& wxDateTime::Subtract(const wxDateSpan
& diff
)
1837 return Add(diff
.Negate());
1840 inline wxDateTime
wxDateTime::Subtract(const wxDateSpan
& diff
) const
1842 return wxDateTime(*this).Subtract(diff
);
1845 inline wxDateTime
& wxDateTime::operator-=(const wxDateSpan
& diff
)
1847 return Subtract(diff
);
1850 inline wxDateTime
& wxDateTime::operator+=(const wxDateSpan
& diff
)
1855 // ----------------------------------------------------------------------------
1856 // wxDateTime and timezones
1857 // ----------------------------------------------------------------------------
1860 wxDateTime::ToTimezone(const wxDateTime::TimeZone
& tz
, bool noDST
) const
1862 MODIFY_AND_RETURN( MakeTimezone(tz
, noDST
) );
1865 #if wxABI_VERSION >= 20602
1868 wxDateTime::FromTimezone(const wxDateTime::TimeZone
& tz
, bool noDST
) const
1870 MODIFY_AND_RETURN( MakeFromTimezone(tz
, noDST
) );
1873 #endif // ABI >= 2.6.2
1875 // ----------------------------------------------------------------------------
1876 // wxTimeSpan construction
1877 // ----------------------------------------------------------------------------
1879 inline wxTimeSpan::wxTimeSpan(long hours
,
1884 // assign first to avoid precision loss
1891 m_diff
+= milliseconds
;
1894 // ----------------------------------------------------------------------------
1895 // wxTimeSpan accessors
1896 // ----------------------------------------------------------------------------
1898 inline wxLongLong
wxTimeSpan::GetSeconds() const
1900 return m_diff
/ 1000l;
1903 inline int wxTimeSpan::GetMinutes() const
1905 return (GetSeconds() / 60l).GetLo();
1908 inline int wxTimeSpan::GetHours() const
1910 return GetMinutes() / 60;
1913 inline int wxTimeSpan::GetDays() const
1915 return GetHours() / 24;
1918 inline int wxTimeSpan::GetWeeks() const
1920 return GetDays() / 7;
1923 // ----------------------------------------------------------------------------
1924 // wxTimeSpan arithmetics
1925 // ----------------------------------------------------------------------------
1927 inline wxTimeSpan
wxTimeSpan::Add(const wxTimeSpan
& diff
) const
1929 return wxTimeSpan(m_diff
+ diff
.GetValue());
1932 inline wxTimeSpan
& wxTimeSpan::Add(const wxTimeSpan
& diff
)
1934 m_diff
+= diff
.GetValue();
1939 inline wxTimeSpan
wxTimeSpan::Subtract(const wxTimeSpan
& diff
) const
1941 return wxTimeSpan(m_diff
- diff
.GetValue());
1944 inline wxTimeSpan
& wxTimeSpan::Subtract(const wxTimeSpan
& diff
)
1946 m_diff
-= diff
.GetValue();
1951 inline wxTimeSpan
& wxTimeSpan::Multiply(int n
)
1958 inline wxTimeSpan
wxTimeSpan::Multiply(int n
) const
1960 return wxTimeSpan(m_diff
* (long)n
);
1963 inline wxTimeSpan
wxTimeSpan::Abs() const
1965 return wxTimeSpan(GetValue().Abs());
1968 inline bool wxTimeSpan::IsEqualTo(const wxTimeSpan
& ts
) const
1970 return GetValue() == ts
.GetValue();
1973 inline bool wxTimeSpan::IsLongerThan(const wxTimeSpan
& ts
) const
1975 return GetValue().Abs() > ts
.GetValue().Abs();
1978 // ----------------------------------------------------------------------------
1980 // ----------------------------------------------------------------------------
1982 inline wxDateSpan
& wxDateSpan::operator+=(const wxDateSpan
& other
)
1984 m_years
+= other
.m_years
;
1985 m_months
+= other
.m_months
;
1986 m_weeks
+= other
.m_weeks
;
1987 m_days
+= other
.m_days
;
1992 inline wxDateSpan
& wxDateSpan::Add(const wxDateSpan
& other
)
1994 return *this += other
;
1997 inline wxDateSpan
wxDateSpan::Add(const wxDateSpan
& other
) const
1999 wxDateSpan
ds(*this);
2004 inline wxDateSpan
& wxDateSpan::Multiply(int factor
)
2014 inline wxDateSpan
wxDateSpan::Multiply(int factor
) const
2016 wxDateSpan
ds(*this);
2017 ds
.Multiply(factor
);
2021 inline wxDateSpan
wxDateSpan::Negate() const
2023 return wxDateSpan(-m_years
, -m_months
, -m_weeks
, -m_days
);
2026 inline wxDateSpan
& wxDateSpan::Neg()
2029 m_months
= -m_months
;
2036 inline wxDateSpan
& wxDateSpan::operator-=(const wxDateSpan
& other
)
2038 return *this += other
.Negate();
2041 inline wxDateSpan
& wxDateSpan::Subtract(const wxDateSpan
& other
)
2043 return *this -= other
;
2046 inline wxDateSpan
wxDateSpan::Subtract(const wxDateSpan
& other
) const
2048 wxDateSpan
ds(*this);
2053 #undef MILLISECONDS_PER_DAY
2055 #undef MODIFY_AND_RETURN
2057 // ============================================================================
2059 // ============================================================================
2061 // ----------------------------------------------------------------------------
2062 // wxTimeSpan operators
2063 // ----------------------------------------------------------------------------
2065 wxTimeSpan WXDLLIMPEXP_BASE
operator*(int n
, const wxTimeSpan
& ts
);
2067 // ----------------------------------------------------------------------------
2069 // ----------------------------------------------------------------------------
2071 wxDateSpan WXDLLIMPEXP_BASE
operator*(int n
, const wxDateSpan
& ds
);
2073 // ============================================================================
2074 // other helper functions
2075 // ============================================================================
2077 // ----------------------------------------------------------------------------
2078 // iteration helpers: can be used to write a for loop over enum variable like
2080 // for ( m = wxDateTime::Jan; m < wxDateTime::Inv_Month; wxNextMonth(m) )
2081 // ----------------------------------------------------------------------------
2083 WXDLLIMPEXP_BASE
void wxNextMonth(wxDateTime::Month
& m
);
2084 WXDLLIMPEXP_BASE
void wxPrevMonth(wxDateTime::Month
& m
);
2085 WXDLLIMPEXP_BASE
void wxNextWDay(wxDateTime::WeekDay
& wd
);
2086 WXDLLIMPEXP_BASE
void wxPrevWDay(wxDateTime::WeekDay
& wd
);
2088 #endif // wxUSE_DATETIME
2090 #endif // _WX_DATETIME_H