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
56 The three (main) classes declared in this header represent:
58 1. An absolute moment in the time (wxDateTime)
59 2. A difference between two moments in the time, positive or negative
61 3. A logical difference between two dates expressed in
62 years/months/weeks/days (wxDateSpan)
64 The following arithmetic operations are permitted (all others are not):
69 wxDateTime + wxTimeSpan = wxDateTime
70 wxDateTime + wxDateSpan = wxDateTime
71 wxTimeSpan + wxTimeSpan = wxTimeSpan
72 wxDateSpan + wxDateSpan = wxDateSpan
76 wxDateTime - wxDateTime = wxTimeSpan
77 wxDateTime - wxTimeSpan = wxDateTime
78 wxDateTime - wxDateSpan = wxDateTime
79 wxTimeSpan - wxTimeSpan = wxTimeSpan
80 wxDateSpan - wxDateSpan = wxDateSpan
84 wxTimeSpan * number = wxTimeSpan
85 number * wxTimeSpan = wxTimeSpan
86 wxDateSpan * number = wxDateSpan
87 number * wxDateSpan = wxDateSpan
91 -wxTimeSpan = wxTimeSpan
92 -wxDateSpan = wxDateSpan
94 For each binary operation OP (+, -, *) we have the following operatorOP=() as
95 a method and the method with a symbolic name OPER (Add, Subtract, Multiply)
96 as a synonym for it and another const method with the same name which returns
97 the changed copy of the object and operatorOP() as a global function which is
98 implemented in terms of the const version of OPEN. For the unary - we have
99 operator-() as a method, Neg() as synonym for it and Negate() which returns
100 the copy of the object with the changed sign.
103 // an invalid/default date time object which may be used as the default
104 // argument for arguments of type wxDateTime; it is also returned by all
105 // functions returning wxDateTime on failure (this is why it is also called
106 // wxInvalidDateTime)
107 class WXDLLIMPEXP_BASE wxDateTime
;
109 extern WXDLLIMPEXP_DATA_BASE(const wxChar
*) wxDefaultDateTimeFormat
;
110 extern WXDLLIMPEXP_DATA_BASE(const wxChar
*) wxDefaultTimeSpanFormat
;
111 extern WXDLLIMPEXP_DATA_BASE(const wxDateTime
) wxDefaultDateTime
;
113 #define wxInvalidDateTime wxDefaultDateTime
115 // ----------------------------------------------------------------------------
116 // wxDateTime represents an absolute moment in the time
117 // ----------------------------------------------------------------------------
119 class WXDLLIMPEXP_BASE wxDateTime
123 // ------------------------------------------------------------------------
125 // a small unsigned integer type for storing things like minutes,
126 // seconds &c. It should be at least short (i.e. not char) to contain
127 // the number of milliseconds - it may also be 'int' because there is
128 // no size penalty associated with it in our code, we don't store any
129 // data in this format
130 typedef unsigned short wxDateTime_t
;
133 // ------------------------------------------------------------------------
138 // the time in the current time zone
141 // zones from GMT (= Greenwhich Mean Time): they're guaranteed to be
142 // consequent numbers, so writing something like `GMT0 + offset' is
143 // safe if abs(offset) <= 12
145 // underscore stands for minus
146 GMT_12
, GMT_11
, GMT_10
, GMT_9
, GMT_8
, GMT_7
,
147 GMT_6
, GMT_5
, GMT_4
, GMT_3
, GMT_2
, GMT_1
,
149 GMT1
, GMT2
, GMT3
, GMT4
, GMT5
, GMT6
,
150 GMT7
, GMT8
, GMT9
, GMT10
, GMT11
, GMT12
,
151 // Note that GMT12 and GMT_12 are not the same: there is a difference
152 // of exactly one day between them
154 // some symbolic names for TZ
157 WET
= GMT0
, // Western Europe Time
158 WEST
= GMT1
, // Western Europe Summer Time
159 CET
= GMT1
, // Central Europe Time
160 CEST
= GMT2
, // Central Europe Summer Time
161 EET
= GMT2
, // Eastern Europe Time
162 EEST
= GMT3
, // Eastern Europe Summer Time
163 MSK
= GMT3
, // Moscow Time
164 MSD
= GMT4
, // Moscow Summer Time
167 AST
= GMT_4
, // Atlantic Standard Time
168 ADT
= GMT_3
, // Atlantic Daylight Time
169 EST
= GMT_5
, // Eastern Standard Time
170 EDT
= GMT_4
, // Eastern Daylight Saving Time
171 CST
= GMT_6
, // Central Standard Time
172 CDT
= GMT_5
, // Central Daylight Saving Time
173 MST
= GMT_7
, // Mountain Standard Time
174 MDT
= GMT_6
, // Mountain Daylight Saving Time
175 PST
= GMT_8
, // Pacific Standard Time
176 PDT
= GMT_7
, // Pacific Daylight Saving Time
177 HST
= GMT_10
, // Hawaiian Standard Time
178 AKST
= GMT_9
, // Alaska Standard Time
179 AKDT
= GMT_8
, // Alaska Daylight Saving Time
183 A_WST
= GMT8
, // Western Standard Time
184 A_CST
= GMT12
+ 1, // Central Standard Time (+9.5)
185 A_EST
= GMT10
, // Eastern Standard Time
186 A_ESST
= GMT11
, // Eastern Summer Time
188 // TODO add more symbolic timezone names here
190 // Universal Coordinated Time = the new and politically correct name
195 // the calendar systems we know about: notice that it's valid (for
196 // this classes purpose anyhow) to work with any of these calendars
197 // even with the dates before the historical appearance of the
201 Gregorian
, // current calendar
202 Julian
// calendar in use since -45 until the 1582 (or later)
204 // TODO Hebrew, Chinese, Maya, ... (just kidding) (or then may be not?)
207 // these values only are used to identify the different dates of
208 // adoption of the Gregorian calendar (see IsGregorian())
210 // All data and comments taken verbatim from "The Calendar FAQ (v 2.0)"
211 // by Claus Tøndering, http://www.pip.dknet.dk/~c-t/calendar.html
212 // except for the comments "we take".
214 // Symbol "->" should be read as "was followed by" in the comments
216 enum GregorianAdoption
218 Gr_Unknown
, // no data for this country or it's too uncertain to use
219 Gr_Standard
, // on the day 0 of Gregorian calendar: 15 Oct 1582
221 Gr_Alaska
, // Oct 1867 when Alaska became part of the USA
222 Gr_Albania
, // Dec 1912
224 Gr_Austria
= Gr_Unknown
, // Different regions on different dates
225 Gr_Austria_Brixen
, // 5 Oct 1583 -> 16 Oct 1583
226 Gr_Austria_Salzburg
= Gr_Austria_Brixen
,
227 Gr_Austria_Tyrol
= Gr_Austria_Brixen
,
228 Gr_Austria_Carinthia
, // 14 Dec 1583 -> 25 Dec 1583
229 Gr_Austria_Styria
= Gr_Austria_Carinthia
,
231 Gr_Belgium
, // Then part of the Netherlands
233 Gr_Bulgaria
= Gr_Unknown
, // Unknown precisely (from 1915 to 1920)
234 Gr_Bulgaria_1
, // 18 Mar 1916 -> 1 Apr 1916
235 Gr_Bulgaria_2
, // 31 Mar 1916 -> 14 Apr 1916
236 Gr_Bulgaria_3
, // 3 Sep 1920 -> 17 Sep 1920
238 Gr_Canada
= Gr_Unknown
, // Different regions followed the changes in
239 // Great Britain or France
241 Gr_China
= Gr_Unknown
, // Different authorities say:
242 Gr_China_1
, // 18 Dec 1911 -> 1 Jan 1912
243 Gr_China_2
, // 18 Dec 1928 -> 1 Jan 1929
245 Gr_Czechoslovakia
, // (Bohemia and Moravia) 6 Jan 1584 -> 17 Jan 1584
246 Gr_Denmark
, // (including Norway) 18 Feb 1700 -> 1 Mar 1700
249 Gr_Finland
, // Then part of Sweden
251 Gr_France
, // 9 Dec 1582 -> 20 Dec 1582
252 Gr_France_Alsace
, // 4 Feb 1682 -> 16 Feb 1682
253 Gr_France_Lorraine
, // 16 Feb 1760 -> 28 Feb 1760
254 Gr_France_Strasbourg
, // February 1682
256 Gr_Germany
= Gr_Unknown
, // Different states on different dates:
257 Gr_Germany_Catholic
, // 1583-1585 (we take 1584)
258 Gr_Germany_Prussia
, // 22 Aug 1610 -> 2 Sep 1610
259 Gr_Germany_Protestant
, // 18 Feb 1700 -> 1 Mar 1700
261 Gr_GreatBritain
, // 2 Sep 1752 -> 14 Sep 1752 (use 'cal(1)')
263 Gr_Greece
, // 9 Mar 1924 -> 23 Mar 1924
264 Gr_Hungary
, // 21 Oct 1587 -> 1 Nov 1587
265 Gr_Ireland
= Gr_GreatBritain
,
266 Gr_Italy
= Gr_Standard
,
268 Gr_Japan
= Gr_Unknown
, // Different authorities say:
269 Gr_Japan_1
, // 19 Dec 1872 -> 1 Jan 1873
270 Gr_Japan_2
, // 19 Dec 1892 -> 1 Jan 1893
271 Gr_Japan_3
, // 18 Dec 1918 -> 1 Jan 1919
273 Gr_Latvia
, // 1915-1918 (we take 1915)
274 Gr_Lithuania
, // 1915
275 Gr_Luxemburg
, // 14 Dec 1582 -> 25 Dec 1582
276 Gr_Netherlands
= Gr_Belgium
, // (including Belgium) 1 Jan 1583
278 // this is too weird to take into account: the Gregorian calendar was
279 // introduced twice in Groningen, first time 28 Feb 1583 was followed
280 // by 11 Mar 1583, then it has gone back to Julian in the summer of
281 // 1584 and then 13 Dec 1700 -> 12 Jan 1701 - which is
282 // the date we take here
283 Gr_Netherlands_Groningen
, // 13 Dec 1700 -> 12 Jan 1701
284 Gr_Netherlands_Gelderland
, // 30 Jun 1700 -> 12 Jul 1700
285 Gr_Netherlands_Utrecht
, // (and Overijssel) 30 Nov 1700->12 Dec 1700
286 Gr_Netherlands_Friesland
, // (and Drenthe) 31 Dec 1700 -> 12 Jan 1701
288 Gr_Norway
= Gr_Denmark
, // Then part of Denmark
289 Gr_Poland
= Gr_Standard
,
290 Gr_Portugal
= Gr_Standard
,
291 Gr_Romania
, // 31 Mar 1919 -> 14 Apr 1919
292 Gr_Russia
, // 31 Jan 1918 -> 14 Feb 1918
293 Gr_Scotland
= Gr_GreatBritain
,
294 Gr_Spain
= Gr_Standard
,
296 // Sweden has a curious history. Sweden decided to make a gradual
297 // change from the Julian to the Gregorian calendar. By dropping every
298 // leap year from 1700 through 1740 the eleven superfluous days would
299 // be omitted and from 1 Mar 1740 they would be in sync with the
300 // Gregorian calendar. (But in the meantime they would be in sync with
303 // So 1700 (which should have been a leap year in the Julian calendar)
304 // was not a leap year in Sweden. However, by mistake 1704 and 1708
305 // became leap years. This left Sweden out of synchronisation with
306 // both the Julian and the Gregorian world, so they decided to go back
307 // to the Julian calendar. In order to do this, they inserted an extra
308 // day in 1712, making that year a double leap year! So in 1712,
309 // February had 30 days in Sweden.
311 // Later, in 1753, Sweden changed to the Gregorian calendar by
312 // dropping 11 days like everyone else.
313 Gr_Sweden
= Gr_Finland
, // 17 Feb 1753 -> 1 Mar 1753
315 Gr_Switzerland
= Gr_Unknown
,// Different cantons used different dates
316 Gr_Switzerland_Catholic
, // 1583, 1584 or 1597 (we take 1584)
317 Gr_Switzerland_Protestant
, // 31 Dec 1700 -> 12 Jan 1701
319 Gr_Turkey
, // 1 Jan 1927
320 Gr_USA
= Gr_GreatBritain
,
321 Gr_Wales
= Gr_GreatBritain
,
322 Gr_Yugoslavia
// 1919
325 // the country parameter is used so far for calculating the start and
326 // the end of DST period and for deciding whether the date is a work
329 // TODO move this to intl.h
331 // Required for WinCE
338 Country_Unknown
, // no special information for this country
339 Country_Default
, // set the default country with SetCountry() method
340 // or use the default country with any other
342 // TODO add more countries (for this we must know about DST and/or
343 // holidays for this country)
345 // Western European countries: we assume that they all follow the same
346 // DST rules (true or false?)
347 Country_WesternEurope_Start
,
348 Country_EEC
= Country_WesternEurope_Start
,
352 Country_WesternEurope_End
= UK
,
357 // symbolic names for the months
360 Jan
, Feb
, Mar
, Apr
, May
, Jun
, Jul
, Aug
, Sep
, Oct
, Nov
, Dec
, Inv_Month
363 // symbolic names for the weekdays
366 Sun
, Mon
, Tue
, Wed
, Thu
, Fri
, Sat
, Inv_WeekDay
369 // invalid value for the year
372 Inv_Year
= SHRT_MIN
// should hold in wxDateTime_t
375 // flags for GetWeekDayName and GetMonthName
378 Name_Full
= 0x01, // return full name
379 Name_Abbr
= 0x02 // return abbreviated name
382 // flags for GetWeekOfYear and GetWeekOfMonth
385 Default_First
, // Sunday_First for US, Monday_First for the rest
386 Monday_First
, // week starts with a Monday
387 Sunday_First
// week starts with a Sunday
391 // ------------------------------------------------------------------------
393 // a class representing a time zone: basicly, this is just an offset
394 // (in seconds) from GMT
395 class WXDLLIMPEXP_BASE TimeZone
399 TimeZone(wxDateTime_t offset
= 0) { m_offset
= offset
; }
401 long GetOffset() const { return m_offset
; }
404 // offset for this timezone from GMT in seconds
408 // standard struct tm is limited to the years from 1900 (because
409 // tm_year field is the offset from 1900), so we use our own struct
410 // instead to represent broken down time
412 // NB: this struct should always be kept normalized (i.e. mon should
413 // be < 12, 1 <= day <= 31 &c), so use AddMonths(), AddDays()
414 // instead of modifying the member fields directly!
415 struct WXDLLIMPEXP_BASE Tm
417 wxDateTime_t msec
, sec
, min
, hour
, mday
;
421 // default ctor inits the object to an invalid value
424 // ctor from struct tm and the timezone
425 Tm(const struct tm
& tm
, const TimeZone
& tz
);
427 // check that the given date/time is valid (in Gregorian calendar)
428 bool IsValid() const;
431 WeekDay
GetWeekDay() // not const because wday may be changed
433 if ( wday
== Inv_WeekDay
)
436 return (WeekDay
)wday
;
439 // add the given number of months to the date keeping it normalized
440 void AddMonths(int monDiff
);
442 // add the given number of months to the date keeping it normalized
443 void AddDays(int dayDiff
);
446 // compute the weekday from other fields
447 void ComputeWeekDay();
449 // the timezone we correspond to
452 // these values can't be accessed directly because they're not always
453 // computed and we calculate them on demand
454 wxDateTime_t wday
, yday
;
458 // ------------------------------------------------------------------------
460 // set the current country
461 static void SetCountry(Country country
);
462 // get the current country
463 static Country
GetCountry();
465 // return true if the country is a West European one (in practice,
466 // this means that the same DST rules as for EEC apply)
467 static bool IsWestEuropeanCountry(Country country
= Country_Default
);
469 // return the current year
470 static int GetCurrentYear(Calendar cal
= Gregorian
);
472 // convert the year as returned by wxDateTime::GetYear() to a year
473 // suitable for BC/AD notation. The difference is that BC year 1
474 // corresponds to the year 0 (while BC year 0 didn't exist) and AD
475 // year N is just year N.
476 static int ConvertYearToBC(int year
);
478 // return the current month
479 static Month
GetCurrentMonth(Calendar cal
= Gregorian
);
481 // returns true if the given year is a leap year in the given calendar
482 static bool IsLeapYear(int year
= Inv_Year
, Calendar cal
= Gregorian
);
484 // get the century (19 for 1999, 20 for 2000 and -5 for 492 BC)
485 static int GetCentury(int year
= Inv_Year
);
487 // returns the number of days in this year (356 or 355 for Gregorian
488 // calendar usually :-)
489 static wxDateTime_t
GetNumberOfDays(int year
, Calendar cal
= Gregorian
);
491 // get the number of the days in the given month (default value for
492 // the year means the current one)
493 static wxDateTime_t
GetNumberOfDays(Month month
,
495 Calendar cal
= Gregorian
);
497 // get the full (default) or abbreviated month name in the current
498 // locale, returns empty string on error
499 static wxString
GetMonthName(Month month
,
500 NameFlags flags
= Name_Full
);
502 // get the full (default) or abbreviated weekday name in the current
503 // locale, returns empty string on error
504 static wxString
GetWeekDayName(WeekDay weekday
,
505 NameFlags flags
= Name_Full
);
507 // get the AM and PM strings in the current locale (may be empty)
508 static void GetAmPmStrings(wxString
*am
, wxString
*pm
);
510 // return true if the given country uses DST for this year
511 static bool IsDSTApplicable(int year
= Inv_Year
,
512 Country country
= Country_Default
);
514 // get the beginning of DST for this year, will return invalid object
515 // if no DST applicable in this year. The default value of the
516 // parameter means to take the current year.
517 static wxDateTime
GetBeginDST(int year
= Inv_Year
,
518 Country country
= Country_Default
);
519 // get the end of DST for this year, will return invalid object
520 // if no DST applicable in this year. The default value of the
521 // parameter means to take the current year.
522 static wxDateTime
GetEndDST(int year
= Inv_Year
,
523 Country country
= Country_Default
);
525 // return the wxDateTime object for the current time
526 static inline wxDateTime
Now();
528 // return the wxDateTime object for the current time with millisecond
529 // precision (if available on this platform)
530 static wxDateTime
UNow();
532 // return the wxDateTime object for today midnight: i.e. as Now() but
533 // with time set to 0
534 static inline wxDateTime
Today();
536 // constructors: you should test whether the constructor succeeded with
537 // IsValid() function. The values Inv_Month and Inv_Year for the
538 // parameters mean take current month and/or year values.
539 // ------------------------------------------------------------------------
541 // default ctor does not initialize the object, use Set()!
542 wxDateTime() { m_time
= wxLongLong((long)ULONG_MAX
, ULONG_MAX
); }
544 // from time_t: seconds since the Epoch 00:00:00 UTC, Jan 1, 1970)
545 #if (!(defined(__VISAGECPP__) && __IBMCPP__ >= 400))
546 // VA C++ confuses this with wxDateTime(double jdn) thinking it is a duplicate declaration
547 inline wxDateTime(time_t timet
);
549 // from broken down time/date (only for standard Unix range)
550 inline wxDateTime(const struct tm
& tm
);
551 // from broken down time/date (any range)
552 inline wxDateTime(const Tm
& tm
);
554 // from JDN (beware of rounding errors)
555 inline wxDateTime(double jdn
);
557 // from separate values for each component, date set to today
558 inline wxDateTime(wxDateTime_t hour
,
559 wxDateTime_t minute
= 0,
560 wxDateTime_t second
= 0,
561 wxDateTime_t millisec
= 0);
562 // from separate values for each component with explicit date
563 inline wxDateTime(wxDateTime_t day
, // day of the month
565 int year
= Inv_Year
, // 1999, not 99 please!
566 wxDateTime_t hour
= 0,
567 wxDateTime_t minute
= 0,
568 wxDateTime_t second
= 0,
569 wxDateTime_t millisec
= 0);
571 // default copy ctor ok
575 // assignment operators and Set() functions: all non const methods return
576 // the reference to this object. IsValid() should be used to test whether
577 // the function succeeded.
578 // ------------------------------------------------------------------------
580 // set to the current time
581 inline wxDateTime
& SetToCurrent();
583 #if (!(defined(__VISAGECPP__) && __IBMCPP__ >= 400))
584 // VA C++ confuses this with wxDateTime(double jdn) thinking it is a duplicate declaration
585 // set to given time_t value
586 inline wxDateTime
& Set(time_t timet
);
589 // set to given broken down time/date
590 wxDateTime
& Set(const struct tm
& tm
);
592 // set to given broken down time/date
593 inline wxDateTime
& Set(const Tm
& tm
);
595 // set to given JDN (beware of rounding errors)
596 wxDateTime
& Set(double jdn
);
598 // set to given time, date = today
599 wxDateTime
& Set(wxDateTime_t hour
,
600 wxDateTime_t minute
= 0,
601 wxDateTime_t second
= 0,
602 wxDateTime_t millisec
= 0);
604 // from separate values for each component with explicit date
605 // (defaults for month and year are the current values)
606 wxDateTime
& Set(wxDateTime_t day
,
608 int year
= Inv_Year
, // 1999, not 99 please!
609 wxDateTime_t hour
= 0,
610 wxDateTime_t minute
= 0,
611 wxDateTime_t second
= 0,
612 wxDateTime_t millisec
= 0);
614 // resets time to 00:00:00, doesn't change the date
615 wxDateTime
& ResetTime();
617 // the following functions don't change the values of the other
618 // fields, i.e. SetMinute() won't change either hour or seconds value
621 wxDateTime
& SetYear(int year
);
623 wxDateTime
& SetMonth(Month month
);
624 // set the day of the month
625 wxDateTime
& SetDay(wxDateTime_t day
);
627 wxDateTime
& SetHour(wxDateTime_t hour
);
629 wxDateTime
& SetMinute(wxDateTime_t minute
);
631 wxDateTime
& SetSecond(wxDateTime_t second
);
633 wxDateTime
& SetMillisecond(wxDateTime_t millisecond
);
635 // assignment operator from time_t
636 wxDateTime
& operator=(time_t timet
) { return Set(timet
); }
638 // assignment operator from broken down time/date
639 wxDateTime
& operator=(const struct tm
& tm
) { return Set(tm
); }
641 // assignment operator from broken down time/date
642 wxDateTime
& operator=(const Tm
& tm
) { return Set(tm
); }
644 // default assignment operator is ok
646 // calendar calculations (functions which set the date only leave the time
647 // unchanged, e.g. don't explictly zero it): SetXXX() functions modify the
648 // object itself, GetXXX() ones return a new object.
649 // ------------------------------------------------------------------------
651 // set to the given week day in the same week as this one
652 wxDateTime
& SetToWeekDayInSameWeek(WeekDay weekday
,
653 WeekFlags flags
= Monday_First
);
654 inline wxDateTime
GetWeekDayInSameWeek(WeekDay weekday
,
655 WeekFlags flags
= Monday_First
) const;
657 // set to the next week day following this one
658 wxDateTime
& SetToNextWeekDay(WeekDay weekday
);
659 inline wxDateTime
GetNextWeekDay(WeekDay weekday
) const;
661 // set to the previous week day before this one
662 wxDateTime
& SetToPrevWeekDay(WeekDay weekday
);
663 inline wxDateTime
GetPrevWeekDay(WeekDay weekday
) const;
665 // set to Nth occurence of given weekday in the given month of the
666 // given year (time is set to 0), return true on success and false on
667 // failure. n may be positive (1..5) or negative to count from the end
668 // of the month (see helper function SetToLastWeekDay())
669 bool SetToWeekDay(WeekDay weekday
,
671 Month month
= Inv_Month
,
672 int year
= Inv_Year
);
673 inline wxDateTime
GetWeekDay(WeekDay weekday
,
675 Month month
= Inv_Month
,
676 int year
= Inv_Year
) const;
678 // sets to the last weekday in the given month, year
679 inline bool SetToLastWeekDay(WeekDay weekday
,
680 Month month
= Inv_Month
,
681 int year
= Inv_Year
);
682 inline wxDateTime
GetLastWeekDay(WeekDay weekday
,
683 Month month
= Inv_Month
,
684 int year
= Inv_Year
);
686 // sets the date to the given day of the given week in the year,
687 // returns true on success and false if given date doesn't exist (e.g.
690 // these functions are badly defined as they're not the reverse of
691 // GetWeekOfYear(), use SetToTheWeekOfYear() instead
692 wxDEPRECATED( bool SetToTheWeek(wxDateTime_t numWeek
,
693 WeekDay weekday
= Mon
,
694 WeekFlags flags
= Monday_First
) );
695 wxDEPRECATED( wxDateTime
GetWeek(wxDateTime_t numWeek
,
696 WeekDay weekday
= Mon
,
697 WeekFlags flags
= Monday_First
) const );
699 // returns the date corresponding to the given week day of the given
700 // week (in ISO notation) of the specified year
701 static wxDateTime
SetToWeekOfYear(int year
,
702 wxDateTime_t numWeek
,
703 WeekDay weekday
= Mon
);
705 // sets the date to the last day of the given (or current) month or the
706 // given (or current) year
707 wxDateTime
& SetToLastMonthDay(Month month
= Inv_Month
,
708 int year
= Inv_Year
);
709 inline wxDateTime
GetLastMonthDay(Month month
= Inv_Month
,
710 int year
= Inv_Year
) const;
712 // sets to the given year day (1..365 or 366)
713 wxDateTime
& SetToYearDay(wxDateTime_t yday
);
714 inline wxDateTime
GetYearDay(wxDateTime_t yday
) const;
716 // The definitions below were taken verbatim from
718 // http://www.capecod.net/~pbaum/date/date0.htm
720 // (Peter Baum's home page)
722 // definition: The Julian Day Number, Julian Day, or JD of a
723 // particular instant of time is the number of days and fractions of a
724 // day since 12 hours Universal Time (Greenwich mean noon) on January
725 // 1 of the year -4712, where the year is given in the Julian
726 // proleptic calendar. The idea of using this reference date was
727 // originally proposed by Joseph Scalizer in 1582 to count years but
728 // it was modified by 19th century astronomers to count days. One
729 // could have equivalently defined the reference time to be noon of
730 // November 24, -4713 if were understood that Gregorian calendar rules
731 // were applied. Julian days are Julian Day Numbers and are not to be
732 // confused with Julian dates.
734 // definition: The Rata Die number is a date specified as the number
735 // of days relative to a base date of December 31 of the year 0. Thus
736 // January 1 of the year 1 is Rata Die day 1.
738 // get the Julian Day number (the fractional part specifies the time of
739 // the day, related to noon - beware of rounding errors!)
740 double GetJulianDayNumber() const;
741 double GetJDN() const { return GetJulianDayNumber(); }
743 // get the Modified Julian Day number: it is equal to JDN - 2400000.5
744 // and so integral MJDs correspond to the midnights (and not noons).
745 // MJD 0 is Nov 17, 1858
746 double GetModifiedJulianDayNumber() const { return GetJDN() - 2400000.5; }
747 double GetMJD() const { return GetModifiedJulianDayNumber(); }
749 // get the Rata Die number
750 double GetRataDie() const;
752 // TODO algorithms for calculating some important dates, such as
753 // religious holidays (Easter...) or moon/solar eclipses? Some
754 // algorithms can be found in the calendar FAQ
757 // Timezone stuff: a wxDateTime object constructed using given
758 // day/month/year/hour/min/sec values is interpreted as this moment in
759 // local time. Using the functions below, it may be converted to another
760 // time zone (e.g., the Unix epoch is wxDateTime(1, Jan, 1970).ToGMT()).
762 // These functions try to handle DST internally, but there is no magical
763 // way to know all rules for it in all countries in the world, so if the
764 // program can handle it itself (or doesn't want to handle it at all for
765 // whatever reason), the DST handling can be disabled with noDST.
766 // ------------------------------------------------------------------------
768 // transform to any given timezone
769 inline wxDateTime
ToTimezone(const TimeZone
& tz
, bool noDST
= false) const;
770 wxDateTime
& MakeTimezone(const TimeZone
& tz
, bool noDST
= false);
772 #if wxABI_VERSION >= 20602
773 // interpret current value as being in another timezone and transform
775 inline wxDateTime
FromTimezone(const TimeZone
& tz
, bool noDST
= false) const;
776 wxDateTime
& MakeFromTimezone(const TimeZone
& tz
, bool noDST
= false);
777 #endif // ABI >= 2.6.2
779 // transform to/from GMT/UTC
780 wxDateTime
ToUTC(bool noDST
= false) const { return ToTimezone(UTC
, noDST
); }
781 wxDateTime
& MakeUTC(bool noDST
= false) { return MakeTimezone(UTC
, noDST
); }
783 wxDateTime
ToGMT(bool noDST
= false) const { return ToUTC(noDST
); }
784 wxDateTime
& MakeGMT(bool noDST
= false) { return MakeUTC(noDST
); }
786 #if wxABI_VERSION >= 20602
787 wxDateTime
FromUTC(bool noDST
= false) const
788 { return FromTimezone(UTC
, noDST
); }
789 wxDateTime
& MakeFromUTC(bool noDST
= false)
790 { return MakeFromTimezone(UTC
, noDST
); }
791 #endif // ABI >= 2.6.2
793 // is daylight savings time in effect at this moment according to the
794 // rules of the specified country?
796 // Return value is > 0 if DST is in effect, 0 if it is not and -1 if
797 // the information is not available (this is compatible with ANSI C)
798 int IsDST(Country country
= Country_Default
) const;
801 // accessors: many of them take the timezone parameter which indicates the
802 // timezone for which to make the calculations and the default value means
803 // to do it for the current timezone of this machine (even if the function
804 // only operates with the date it's necessary because a date may wrap as
805 // result of timezone shift)
806 // ------------------------------------------------------------------------
808 // is the date valid?
809 inline bool IsValid() const { return m_time
!= wxInvalidDateTime
.m_time
; }
811 // get the broken down date/time representation in the given timezone
813 // If you wish to get several time components (day, month and year),
814 // consider getting the whole Tm strcuture first and retrieving the
815 // value from it - this is much more efficient
816 Tm
GetTm(const TimeZone
& tz
= Local
) const;
818 // get the number of seconds since the Unix epoch - returns (time_t)-1
819 // if the value is out of range
820 inline time_t GetTicks() const;
822 // get the year (returns Inv_Year if date is invalid)
823 int GetYear(const TimeZone
& tz
= Local
) const
824 { return GetTm(tz
).year
; }
825 // get the month (Inv_Month if date is invalid)
826 Month
GetMonth(const TimeZone
& tz
= Local
) const
827 { return (Month
)GetTm(tz
).mon
; }
828 // get the month day (in 1..31 range, 0 if date is invalid)
829 wxDateTime_t
GetDay(const TimeZone
& tz
= Local
) const
830 { return GetTm(tz
).mday
; }
831 // get the day of the week (Inv_WeekDay if date is invalid)
832 WeekDay
GetWeekDay(const TimeZone
& tz
= Local
) const
833 { return GetTm(tz
).GetWeekDay(); }
834 // get the hour of the day
835 wxDateTime_t
GetHour(const TimeZone
& tz
= Local
) const
836 { return GetTm(tz
).hour
; }
838 wxDateTime_t
GetMinute(const TimeZone
& tz
= Local
) const
839 { return GetTm(tz
).min
; }
841 wxDateTime_t
GetSecond(const TimeZone
& tz
= Local
) const
842 { return GetTm(tz
).sec
; }
844 wxDateTime_t
GetMillisecond(const TimeZone
& tz
= Local
) const
845 { return GetTm(tz
).msec
; }
847 // get the day since the year start (1..366, 0 if date is invalid)
848 wxDateTime_t
GetDayOfYear(const TimeZone
& tz
= Local
) const;
849 // get the week number since the year start (1..52 or 53, 0 if date is
851 wxDateTime_t
GetWeekOfYear(WeekFlags flags
= Monday_First
,
852 const TimeZone
& tz
= Local
) const;
853 // get the week number since the month start (1..5, 0 if date is
855 wxDateTime_t
GetWeekOfMonth(WeekFlags flags
= Monday_First
,
856 const TimeZone
& tz
= Local
) const;
858 // is this date a work day? This depends on a country, of course,
859 // because the holidays are different in different countries
860 bool IsWorkDay(Country country
= Country_Default
) const;
862 // is this date later than Gregorian calendar introduction for the
863 // given country (see enum GregorianAdoption)?
865 // NB: this function shouldn't be considered as absolute authority in
866 // the matter. Besides, for some countries the exact date of
867 // adoption of the Gregorian calendar is simply unknown.
868 bool IsGregorianDate(GregorianAdoption country
= Gr_Standard
) const;
870 // dos date and time format
871 // ------------------------------------------------------------------------
873 // set from the DOS packed format
874 wxDateTime
& SetFromDOS(unsigned long ddt
);
876 // pack the date in DOS format
877 unsigned long GetAsDOS() const;
879 // comparison (see also functions below for operator versions)
880 // ------------------------------------------------------------------------
882 // returns true if the two moments are strictly identical
883 inline bool IsEqualTo(const wxDateTime
& datetime
) const;
885 // returns true if the date is strictly earlier than the given one
886 inline bool IsEarlierThan(const wxDateTime
& datetime
) const;
888 // returns true if the date is strictly later than the given one
889 inline bool IsLaterThan(const wxDateTime
& datetime
) const;
891 // returns true if the date is strictly in the given range
892 inline bool IsStrictlyBetween(const wxDateTime
& t1
,
893 const wxDateTime
& t2
) const;
895 // returns true if the date is in the given range
896 inline bool IsBetween(const wxDateTime
& t1
, const wxDateTime
& t2
) const;
898 // do these two objects refer to the same date?
899 inline bool IsSameDate(const wxDateTime
& dt
) const;
901 // do these two objects have the same time?
902 inline bool IsSameTime(const wxDateTime
& dt
) const;
904 // are these two objects equal up to given timespan?
905 inline bool IsEqualUpTo(const wxDateTime
& dt
, const wxTimeSpan
& ts
) const;
907 inline bool operator<(const wxDateTime
& dt
) const
909 wxASSERT_MSG( IsValid() && dt
.IsValid(), _T("invalid wxDateTime") );
910 return GetValue() < dt
.GetValue();
913 inline bool operator<=(const wxDateTime
& dt
) const
915 wxASSERT_MSG( IsValid() && dt
.IsValid(), _T("invalid wxDateTime") );
916 return GetValue() <= dt
.GetValue();
919 inline bool operator>(const wxDateTime
& dt
) const
921 wxASSERT_MSG( IsValid() && dt
.IsValid(), _T("invalid wxDateTime") );
922 return GetValue() > dt
.GetValue();
925 inline bool operator>=(const wxDateTime
& dt
) const
927 wxASSERT_MSG( IsValid() && dt
.IsValid(), _T("invalid wxDateTime") );
928 return GetValue() >= dt
.GetValue();
931 inline bool operator==(const wxDateTime
& dt
) const
933 wxASSERT_MSG( IsValid() && dt
.IsValid(), _T("invalid wxDateTime") );
934 return GetValue() == dt
.GetValue();
937 inline bool operator!=(const wxDateTime
& dt
) const
939 wxASSERT_MSG( IsValid() && dt
.IsValid(), _T("invalid wxDateTime") );
940 return GetValue() != dt
.GetValue();
943 // arithmetics with dates (see also below for more operators)
944 // ------------------------------------------------------------------------
946 // return the sum of the date with a time span (positive or negative)
947 inline wxDateTime
Add(const wxTimeSpan
& diff
) const;
948 // add a time span (positive or negative)
949 inline wxDateTime
& Add(const wxTimeSpan
& diff
);
950 // add a time span (positive or negative)
951 inline wxDateTime
& operator+=(const wxTimeSpan
& diff
);
952 inline wxDateTime
operator+(const wxTimeSpan
& ts
) const
954 wxDateTime
dt(*this);
959 // return the difference of the date with a time span
960 inline wxDateTime
Subtract(const wxTimeSpan
& diff
) const;
961 // subtract a time span (positive or negative)
962 inline wxDateTime
& Subtract(const wxTimeSpan
& diff
);
963 // subtract a time span (positive or negative)
964 inline wxDateTime
& operator-=(const wxTimeSpan
& diff
);
965 inline wxDateTime
operator-(const wxTimeSpan
& ts
) const
967 wxDateTime
dt(*this);
972 // return the sum of the date with a date span
973 inline wxDateTime
Add(const wxDateSpan
& diff
) const;
974 // add a date span (positive or negative)
975 wxDateTime
& Add(const wxDateSpan
& diff
);
976 // add a date span (positive or negative)
977 inline wxDateTime
& operator+=(const wxDateSpan
& diff
);
978 inline wxDateTime
operator+(const wxDateSpan
& ds
) const
980 wxDateTime
dt(*this);
985 // return the difference of the date with a date span
986 inline wxDateTime
Subtract(const wxDateSpan
& diff
) const;
987 // subtract a date span (positive or negative)
988 inline wxDateTime
& Subtract(const wxDateSpan
& diff
);
989 // subtract a date span (positive or negative)
990 inline wxDateTime
& operator-=(const wxDateSpan
& diff
);
991 inline wxDateTime
operator-(const wxDateSpan
& ds
) const
993 wxDateTime
dt(*this);
998 // return the difference between two dates
999 inline wxTimeSpan
Subtract(const wxDateTime
& dt
) const;
1000 inline wxTimeSpan
operator-(const wxDateTime
& dt2
) const;
1002 // conversion to/from text: all conversions from text return the pointer to
1003 // the next character following the date specification (i.e. the one where
1004 // the scan had to stop) or NULL on failure.
1005 // ------------------------------------------------------------------------
1007 // parse a string in RFC 822 format (found e.g. in mail headers and
1008 // having the form "Wed, 10 Feb 1999 19:07:07 +0100")
1009 const wxChar
*ParseRfc822Date(const wxChar
* date
);
1010 // parse a date/time in the given format (see strptime(3)), fill in
1011 // the missing (in the string) fields with the values of dateDef (by
1012 // default, they will not change if they had valid values or will
1013 // default to Today() otherwise)
1014 const wxChar
*ParseFormat(const wxChar
*date
,
1015 const wxChar
*format
= wxDefaultDateTimeFormat
,
1016 const wxDateTime
& dateDef
= wxDefaultDateTime
);
1017 // parse a string containing the date/time in "free" format, this
1018 // function will try to make an educated guess at the string contents
1019 const wxChar
*ParseDateTime(const wxChar
*datetime
);
1020 // parse a string containing the date only in "free" format (less
1021 // flexible than ParseDateTime)
1022 const wxChar
*ParseDate(const wxChar
*date
);
1023 // parse a string containing the time only in "free" format
1024 const wxChar
*ParseTime(const wxChar
*time
);
1026 // this function accepts strftime()-like format string (default
1027 // argument corresponds to the preferred date and time representation
1028 // for the current locale) and returns the string containing the
1029 // resulting text representation
1030 wxString
Format(const wxChar
*format
= wxDefaultDateTimeFormat
,
1031 const TimeZone
& tz
= Local
) const;
1032 // preferred date representation for the current locale
1033 wxString
FormatDate() const { return Format(_T("%x")); }
1034 // preferred time representation for the current locale
1035 wxString
FormatTime() const { return Format(_T("%X")); }
1036 // returns the string representing the date in ISO 8601 format
1038 wxString
FormatISODate() const { return Format(_T("%Y-%m-%d")); }
1039 // returns the string representing the time in ISO 8601 format
1041 wxString
FormatISOTime() const { return Format(_T("%H:%M:%S")); }
1044 // ------------------------------------------------------------------------
1046 // construct from internal representation
1047 wxDateTime(const wxLongLong
& time
) { m_time
= time
; }
1049 // get the internal representation
1050 inline wxLongLong
GetValue() const;
1052 // a helper function to get the current time_t
1053 static time_t GetTimeNow() { return time((time_t *)NULL
); }
1055 // another one to get the current time broken down
1056 static struct tm
*GetTmNow()
1058 time_t t
= GetTimeNow();
1059 return localtime(&t
);
1063 // the current country - as it's the same for all program objects (unless
1064 // it runs on a _really_ big cluster system :-), this is a static member:
1065 // see SetCountry() and GetCountry()
1066 static Country ms_country
;
1068 // this constant is used to transform a time_t value to the internal
1069 // representation, as time_t is in seconds and we use milliseconds it's
1071 static const long TIME_T_FACTOR
;
1073 // returns true if we fall in range in which we can use standard ANSI C
1075 inline bool IsInStdRange() const;
1077 // the internal representation of the time is the amount of milliseconds
1078 // elapsed since the origin which is set by convention to the UNIX/C epoch
1079 // value: the midnight of January 1, 1970 (UTC)
1083 // ----------------------------------------------------------------------------
1084 // This class contains a difference between 2 wxDateTime values, so it makes
1085 // sense to add it to wxDateTime and it is the result of subtraction of 2
1086 // objects of that class. See also wxDateSpan.
1087 // ----------------------------------------------------------------------------
1089 class WXDLLIMPEXP_BASE wxTimeSpan
1093 // ------------------------------------------------------------------------
1095 // return the timespan for the given number of seconds
1096 static wxTimeSpan
Seconds(long sec
) { return wxTimeSpan(0, 0, sec
); }
1097 static wxTimeSpan
Second() { return Seconds(1); }
1099 // return the timespan for the given number of minutes
1100 static wxTimeSpan
Minutes(long min
) { return wxTimeSpan(0, min
, 0 ); }
1101 static wxTimeSpan
Minute() { return Minutes(1); }
1103 // return the timespan for the given number of hours
1104 static wxTimeSpan
Hours(long hours
) { return wxTimeSpan(hours
, 0, 0); }
1105 static wxTimeSpan
Hour() { return Hours(1); }
1107 // return the timespan for the given number of days
1108 static wxTimeSpan
Days(long days
) { return Hours(24 * days
); }
1109 static wxTimeSpan
Day() { return Days(1); }
1111 // return the timespan for the given number of weeks
1112 static wxTimeSpan
Weeks(long days
) { return Days(7 * days
); }
1113 static wxTimeSpan
Week() { return Weeks(1); }
1115 // default ctor constructs the 0 time span
1118 // from separate values for each component, date set to 0 (hours are
1119 // not restricted to 0..24 range, neither are minutes, seconds or
1121 inline wxTimeSpan(long hours
,
1124 long milliseconds
= 0);
1126 // default copy ctor is ok
1130 // arithmetics with time spans (see also below for more operators)
1131 // ------------------------------------------------------------------------
1133 // return the sum of two timespans
1134 inline wxTimeSpan
Add(const wxTimeSpan
& diff
) const;
1135 // add two timespans together
1136 inline wxTimeSpan
& Add(const wxTimeSpan
& diff
);
1137 // add two timespans together
1138 wxTimeSpan
& operator+=(const wxTimeSpan
& diff
) { return Add(diff
); }
1139 inline wxTimeSpan
operator+(const wxTimeSpan
& ts
) const
1141 return wxTimeSpan(GetValue() + ts
.GetValue());
1144 // return the difference of two timespans
1145 inline wxTimeSpan
Subtract(const wxTimeSpan
& diff
) const;
1146 // subtract another timespan
1147 inline wxTimeSpan
& Subtract(const wxTimeSpan
& diff
);
1148 // subtract another timespan
1149 wxTimeSpan
& operator-=(const wxTimeSpan
& diff
) { return Subtract(diff
); }
1150 inline wxTimeSpan
operator-(const wxTimeSpan
& ts
)
1152 return wxTimeSpan(GetValue() - ts
.GetValue());
1155 // multiply timespan by a scalar
1156 inline wxTimeSpan
Multiply(int n
) const;
1157 // multiply timespan by a scalar
1158 inline wxTimeSpan
& Multiply(int n
);
1159 // multiply timespan by a scalar
1160 wxTimeSpan
& operator*=(int n
) { return Multiply(n
); }
1161 inline wxTimeSpan
operator*(int n
) const
1163 return wxTimeSpan(*this).Multiply(n
);
1166 // return this timespan with opposite sign
1167 wxTimeSpan
Negate() const { return wxTimeSpan(-GetValue()); }
1168 // negate the value of the timespan
1169 wxTimeSpan
& Neg() { m_diff
= -GetValue(); return *this; }
1170 // negate the value of the timespan
1171 wxTimeSpan
& operator-() { return Neg(); }
1173 // return the absolute value of the timespan: does _not_ modify the
1175 inline wxTimeSpan
Abs() const;
1177 // there is intentionally no division because we don't want to
1178 // introduce rounding errors in time calculations
1180 // comparaison (see also operator versions below)
1181 // ------------------------------------------------------------------------
1183 // is the timespan null?
1184 bool IsNull() const { return m_diff
== 0l; }
1185 // returns true if the timespan is null
1186 bool operator!() const { return !IsNull(); }
1188 // is the timespan positive?
1189 bool IsPositive() const { return m_diff
> 0l; }
1191 // is the timespan negative?
1192 bool IsNegative() const { return m_diff
< 0l; }
1194 // are two timespans equal?
1195 inline bool IsEqualTo(const wxTimeSpan
& ts
) const;
1196 // compare two timestamps: works with the absolute values, i.e. -2
1197 // hours is longer than 1 hour. Also, it will return false if the
1198 // timespans are equal in absolute value.
1199 inline bool IsLongerThan(const wxTimeSpan
& ts
) const;
1200 // compare two timestamps: works with the absolute values, i.e. 1
1201 // hour is shorter than -2 hours. Also, it will return false if the
1202 // timespans are equal in absolute value.
1203 bool IsShorterThan(const wxTimeSpan
& t
) const { return !IsLongerThan(t
); }
1205 inline bool operator<(const wxTimeSpan
&ts
) const
1207 return GetValue() < ts
.GetValue();
1210 inline bool operator<=(const wxTimeSpan
&ts
) const
1212 return GetValue() <= ts
.GetValue();
1215 inline bool operator>(const wxTimeSpan
&ts
) const
1217 return GetValue() > ts
.GetValue();
1220 inline bool operator>=(const wxTimeSpan
&ts
) const
1222 return GetValue() >= ts
.GetValue();
1225 inline bool operator==(const wxTimeSpan
&ts
) const
1227 return GetValue() == ts
.GetValue();
1230 inline bool operator!=(const wxTimeSpan
&ts
) const
1232 return GetValue() != ts
.GetValue();
1235 // breaking into days, hours, minutes and seconds
1236 // ------------------------------------------------------------------------
1238 // get the max number of weeks in this timespan
1239 inline int GetWeeks() const;
1240 // get the max number of days in this timespan
1241 inline int GetDays() const;
1242 // get the max number of hours in this timespan
1243 inline int GetHours() const;
1244 // get the max number of minutes in this timespan
1245 inline int GetMinutes() const;
1246 // get the max number of seconds in this timespan
1247 inline wxLongLong
GetSeconds() const;
1248 // get the number of milliseconds in this timespan
1249 wxLongLong
GetMilliseconds() const { return m_diff
; }
1251 // conversion to text
1252 // ------------------------------------------------------------------------
1254 // this function accepts strftime()-like format string (default
1255 // argument corresponds to the preferred date and time representation
1256 // for the current locale) and returns the string containing the
1257 // resulting text representation. Notice that only some of format
1258 // specifiers valid for wxDateTime are valid for wxTimeSpan: hours,
1259 // minutes and seconds make sense, but not "PM/AM" string for example.
1260 wxString
Format(const wxChar
*format
= wxDefaultTimeSpanFormat
) const;
1263 // ------------------------------------------------------------------------
1265 // construct from internal representation
1266 wxTimeSpan(const wxLongLong
& diff
) { m_diff
= diff
; }
1268 // get the internal representation
1269 wxLongLong
GetValue() const { return m_diff
; }
1272 // the (signed) time span in milliseconds
1276 // ----------------------------------------------------------------------------
1277 // This class is a "logical time span" and is useful for implementing program
1278 // logic for such things as "add one month to the date" which, in general,
1279 // doesn't mean to add 60*60*24*31 seconds to it, but to take the same date
1280 // the next month (to understand that this is indeed different consider adding
1281 // one month to Feb, 15 - we want to get Mar, 15, of course).
1283 // When adding a month to the date, all lesser components (days, hours, ...)
1284 // won't be changed unless the resulting date would be invalid: for example,
1285 // Jan 31 + 1 month will be Feb 28, not (non existing) Feb 31.
1287 // Because of this feature, adding and subtracting back again the same
1288 // wxDateSpan will *not*, in general give back the original date: Feb 28 - 1
1289 // month will be Jan 28, not Jan 31!
1291 // wxDateSpan can be either positive or negative. They may be
1292 // multiplied by scalars which multiply all deltas by the scalar: i.e. 2*(1
1293 // month and 1 day) is 2 months and 2 days. They can be added together and
1294 // with wxDateTime or wxTimeSpan, but the type of result is different for each
1297 // Beware about weeks: if you specify both weeks and days, the total number of
1298 // days added will be 7*weeks + days! See also GetTotalDays() function.
1300 // Equality operators are defined for wxDateSpans. Two datespans are equal if
1301 // they both give the same target date when added to *every* source date.
1302 // Thus wxDateSpan::Months(1) is not equal to wxDateSpan::Days(30), because
1303 // they not give the same date when added to 1 Feb. But wxDateSpan::Days(14) is
1304 // equal to wxDateSpan::Weeks(2)
1306 // Finally, notice that for adding hours, minutes &c you don't need this
1307 // class: wxTimeSpan will do the job because there are no subtleties
1308 // associated with those.
1309 // ----------------------------------------------------------------------------
1311 class WXDLLIMPEXP_BASE wxDateSpan
1315 // ------------------------------------------------------------------------
1317 // this many years/months/weeks/days
1318 wxDateSpan(int years
= 0, int months
= 0, int weeks
= 0, int days
= 0)
1326 // get an object for the given number of days
1327 static wxDateSpan
Days(int days
) { return wxDateSpan(0, 0, 0, days
); }
1328 static wxDateSpan
Day() { return Days(1); }
1330 // get an object for the given number of weeks
1331 static wxDateSpan
Weeks(int weeks
) { return wxDateSpan(0, 0, weeks
, 0); }
1332 static wxDateSpan
Week() { return Weeks(1); }
1334 // get an object for the given number of months
1335 static wxDateSpan
Months(int mon
) { return wxDateSpan(0, mon
, 0, 0); }
1336 static wxDateSpan
Month() { return Months(1); }
1338 // get an object for the given number of years
1339 static wxDateSpan
Years(int years
) { return wxDateSpan(years
, 0, 0, 0); }
1340 static wxDateSpan
Year() { return Years(1); }
1342 // default copy ctor is ok
1346 // accessors (all SetXXX() return the (modified) wxDateSpan object)
1347 // ------------------------------------------------------------------------
1349 // set number of years
1350 wxDateSpan
& SetYears(int n
) { m_years
= n
; return *this; }
1351 // set number of months
1352 wxDateSpan
& SetMonths(int n
) { m_months
= n
; return *this; }
1353 // set number of weeks
1354 wxDateSpan
& SetWeeks(int n
) { m_weeks
= n
; return *this; }
1355 // set number of days
1356 wxDateSpan
& SetDays(int n
) { m_days
= n
; return *this; }
1358 // get number of years
1359 int GetYears() const { return m_years
; }
1360 // get number of months
1361 int GetMonths() const { return m_months
; }
1362 // get number of weeks
1363 int GetWeeks() const { return m_weeks
; }
1364 // get number of days
1365 int GetDays() const { return m_days
; }
1366 // returns 7*GetWeeks() + GetDays()
1367 int GetTotalDays() const { return 7*m_weeks
+ m_days
; }
1369 // arithmetics with date spans (see also below for more operators)
1370 // ------------------------------------------------------------------------
1372 // return sum of two date spans
1373 inline wxDateSpan
Add(const wxDateSpan
& other
) const;
1374 // add another wxDateSpan to us
1375 inline wxDateSpan
& Add(const wxDateSpan
& other
);
1376 // add another wxDateSpan to us
1377 inline wxDateSpan
& operator+=(const wxDateSpan
& other
);
1378 inline wxDateSpan
operator+(const wxDateSpan
& ds
) const
1380 return wxDateSpan(GetYears() + ds
.GetYears(),
1381 GetMonths() + ds
.GetMonths(),
1382 GetWeeks() + ds
.GetWeeks(),
1383 GetDays() + ds
.GetDays());
1386 // return difference of two date spans
1387 inline wxDateSpan
Subtract(const wxDateSpan
& other
) const;
1388 // subtract another wxDateSpan from us
1389 inline wxDateSpan
& Subtract(const wxDateSpan
& other
);
1390 // subtract another wxDateSpan from 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 a copy of this time span with changed sign
1401 inline wxDateSpan
Negate() const;
1402 // inverse the sign of this timespan
1403 inline wxDateSpan
& Neg();
1404 // inverse the sign of this timespan
1405 wxDateSpan
& operator-() { return Neg(); }
1407 // return the date span proportional to this one with given factor
1408 inline wxDateSpan
Multiply(int factor
) const;
1409 // multiply all components by a (signed) number
1410 inline wxDateSpan
& Multiply(int factor
);
1411 // multiply all components by a (signed) number
1412 inline wxDateSpan
& operator*=(int factor
) { return Multiply(factor
); }
1413 inline wxDateSpan
operator*(int n
) const
1415 return wxDateSpan(*this).Multiply(n
);
1418 // ds1 == d2 if and only if for every wxDateTime t t + ds1 == t + ds2
1419 inline bool operator==(const wxDateSpan
& ds
) const
1421 return GetYears() == ds
.GetYears() &&
1422 GetMonths() == ds
.GetMonths() &&
1423 GetTotalDays() == ds
.GetTotalDays();
1426 inline bool operator!=(const wxDateSpan
& ds
) const
1428 return !(*this == ds
);
1438 // ----------------------------------------------------------------------------
1439 // wxDateTimeArray: array of dates.
1440 // ----------------------------------------------------------------------------
1442 WX_DECLARE_USER_EXPORTED_OBJARRAY(wxDateTime
, wxDateTimeArray
, WXDLLIMPEXP_BASE
);
1444 // ----------------------------------------------------------------------------
1445 // wxDateTimeHolidayAuthority: an object of this class will decide whether a
1446 // given date is a holiday and is used by all functions working with "work
1449 // NB: the base class is an ABC, derived classes must implement the pure
1450 // virtual methods to work with the holidays they correspond to.
1451 // ----------------------------------------------------------------------------
1453 class WXDLLIMPEXP_BASE wxDateTimeHolidayAuthority
;
1454 WX_DEFINE_USER_EXPORTED_ARRAY_PTR(wxDateTimeHolidayAuthority
*,
1455 wxHolidayAuthoritiesArray
,
1456 class WXDLLIMPEXP_BASE
);
1458 class wxDateTimeHolidaysModule
;
1459 class WXDLLIMPEXP_BASE wxDateTimeHolidayAuthority
1461 friend class wxDateTimeHolidaysModule
;
1463 // returns true if the given date is a holiday
1464 static bool IsHoliday(const wxDateTime
& dt
);
1466 // fills the provided array with all holidays in the given range, returns
1467 // the number of them
1468 static size_t GetHolidaysInRange(const wxDateTime
& dtStart
,
1469 const wxDateTime
& dtEnd
,
1470 wxDateTimeArray
& holidays
);
1472 // clear the list of holiday authorities
1473 static void ClearAllAuthorities();
1475 // add a new holiday authority (the pointer will be deleted by
1476 // wxDateTimeHolidayAuthority)
1477 static void AddAuthority(wxDateTimeHolidayAuthority
*auth
);
1479 // the base class must have a virtual dtor
1480 virtual ~wxDateTimeHolidayAuthority();
1483 // this function is called to determine whether a given day is a holiday
1484 virtual bool DoIsHoliday(const wxDateTime
& dt
) const = 0;
1486 // this function should fill the array with all holidays between the two
1487 // given dates - it is implemented in the base class, but in a very
1488 // inefficient way (it just iterates over all days and uses IsHoliday() for
1489 // each of them), so it must be overridden in the derived class where the
1490 // base class version may be explicitly used if needed
1492 // returns the number of holidays in the given range and fills holidays
1494 virtual size_t DoGetHolidaysInRange(const wxDateTime
& dtStart
,
1495 const wxDateTime
& dtEnd
,
1496 wxDateTimeArray
& holidays
) const = 0;
1499 // all holiday authorities
1500 static wxHolidayAuthoritiesArray ms_authorities
;
1503 // the holidays for this class are all Saturdays and Sundays
1504 class WXDLLIMPEXP_BASE wxDateTimeWorkDays
: public wxDateTimeHolidayAuthority
1507 virtual bool DoIsHoliday(const wxDateTime
& dt
) const;
1508 virtual size_t DoGetHolidaysInRange(const wxDateTime
& dtStart
,
1509 const wxDateTime
& dtEnd
,
1510 wxDateTimeArray
& holidays
) const;
1513 // ============================================================================
1514 // inline functions implementation
1515 // ============================================================================
1517 // ----------------------------------------------------------------------------
1519 // ----------------------------------------------------------------------------
1521 #define MILLISECONDS_PER_DAY 86400000l
1523 // some broken compilers (HP-UX CC) refuse to compile the "normal" version, but
1524 // using a temp variable always might prevent other compilers from optimising
1525 // it away - hence use of this ugly macro
1527 #define MODIFY_AND_RETURN(op) return wxDateTime(*this).op
1529 #define MODIFY_AND_RETURN(op) wxDateTime dt(*this); dt.op; return dt
1532 // ----------------------------------------------------------------------------
1533 // wxDateTime construction
1534 // ----------------------------------------------------------------------------
1536 inline bool wxDateTime::IsInStdRange() const
1538 return m_time
>= 0l && (m_time
/ TIME_T_FACTOR
) < LONG_MAX
;
1542 inline wxDateTime
wxDateTime::Now()
1544 return wxDateTime(*GetTmNow());
1548 inline wxDateTime
wxDateTime::Today()
1550 wxDateTime
dt(Now());
1556 #if (!(defined(__VISAGECPP__) && __IBMCPP__ >= 400))
1557 inline wxDateTime
& wxDateTime::Set(time_t timet
)
1559 // assign first to avoid long multiplication overflow!
1560 m_time
= timet
- WX_TIME_BASE_OFFSET
;
1561 m_time
*= TIME_T_FACTOR
;
1567 inline wxDateTime
& wxDateTime::SetToCurrent()
1573 #if (!(defined(__VISAGECPP__) && __IBMCPP__ >= 400))
1574 inline wxDateTime::wxDateTime(time_t timet
)
1580 inline wxDateTime::wxDateTime(const struct tm
& tm
)
1585 inline wxDateTime::wxDateTime(const Tm
& tm
)
1590 inline wxDateTime::wxDateTime(double jdn
)
1595 inline wxDateTime
& wxDateTime::Set(const Tm
& tm
)
1597 wxASSERT_MSG( tm
.IsValid(), _T("invalid broken down date/time") );
1599 return Set(tm
.mday
, (Month
)tm
.mon
, tm
.year
,
1600 tm
.hour
, tm
.min
, tm
.sec
, tm
.msec
);
1603 inline wxDateTime::wxDateTime(wxDateTime_t hour
,
1604 wxDateTime_t minute
,
1605 wxDateTime_t second
,
1606 wxDateTime_t millisec
)
1608 Set(hour
, minute
, second
, millisec
);
1611 inline wxDateTime::wxDateTime(wxDateTime_t day
,
1615 wxDateTime_t minute
,
1616 wxDateTime_t second
,
1617 wxDateTime_t millisec
)
1619 Set(day
, month
, year
, hour
, minute
, second
, millisec
);
1622 // ----------------------------------------------------------------------------
1623 // wxDateTime accessors
1624 // ----------------------------------------------------------------------------
1626 inline wxLongLong
wxDateTime::GetValue() const
1628 wxASSERT_MSG( IsValid(), _T("invalid wxDateTime"));
1633 inline time_t wxDateTime::GetTicks() const
1635 wxASSERT_MSG( IsValid(), _T("invalid wxDateTime"));
1636 if ( !IsInStdRange() )
1641 return (time_t)((m_time
/ (long)TIME_T_FACTOR
).GetLo())+WX_TIME_BASE_OFFSET
;
1644 inline bool wxDateTime::SetToLastWeekDay(WeekDay weekday
,
1648 return SetToWeekDay(weekday
, -1, month
, year
);
1652 wxDateTime::GetWeekDayInSameWeek(WeekDay weekday
,
1653 WeekFlags
WXUNUSED(flags
)) const
1655 MODIFY_AND_RETURN( SetToWeekDayInSameWeek(weekday
) );
1658 inline wxDateTime
wxDateTime::GetNextWeekDay(WeekDay weekday
) const
1660 MODIFY_AND_RETURN( SetToNextWeekDay(weekday
) );
1663 inline wxDateTime
wxDateTime::GetPrevWeekDay(WeekDay weekday
) const
1665 MODIFY_AND_RETURN( SetToPrevWeekDay(weekday
) );
1668 inline wxDateTime
wxDateTime::GetWeekDay(WeekDay weekday
,
1673 wxDateTime
dt(*this);
1675 return dt
.SetToWeekDay(weekday
, n
, month
, year
) ? dt
: wxInvalidDateTime
;
1678 inline wxDateTime
wxDateTime::GetLastWeekDay(WeekDay weekday
,
1682 wxDateTime
dt(*this);
1684 return dt
.SetToLastWeekDay(weekday
, month
, year
) ? dt
: wxInvalidDateTime
;
1687 inline wxDateTime
wxDateTime::GetLastMonthDay(Month month
, int year
) const
1689 MODIFY_AND_RETURN( SetToLastMonthDay(month
, year
) );
1692 inline wxDateTime
wxDateTime::GetYearDay(wxDateTime_t yday
) const
1694 MODIFY_AND_RETURN( SetToYearDay(yday
) );
1697 // ----------------------------------------------------------------------------
1698 // wxDateTime comparison
1699 // ----------------------------------------------------------------------------
1701 inline bool wxDateTime::IsEqualTo(const wxDateTime
& datetime
) const
1703 wxASSERT_MSG( IsValid() && datetime
.IsValid(), _T("invalid wxDateTime"));
1705 return m_time
== datetime
.m_time
;
1708 inline bool wxDateTime::IsEarlierThan(const wxDateTime
& datetime
) const
1710 wxASSERT_MSG( IsValid() && datetime
.IsValid(), _T("invalid wxDateTime"));
1712 return m_time
< datetime
.m_time
;
1715 inline bool wxDateTime::IsLaterThan(const wxDateTime
& datetime
) const
1717 wxASSERT_MSG( IsValid() && datetime
.IsValid(), _T("invalid wxDateTime"));
1719 return m_time
> datetime
.m_time
;
1722 inline bool wxDateTime::IsStrictlyBetween(const wxDateTime
& t1
,
1723 const wxDateTime
& t2
) const
1725 // no need for assert, will be checked by the functions we call
1726 return IsLaterThan(t1
) && IsEarlierThan(t2
);
1729 inline bool wxDateTime::IsBetween(const wxDateTime
& t1
,
1730 const wxDateTime
& t2
) const
1732 // no need for assert, will be checked by the functions we call
1733 return IsEqualTo(t1
) || IsEqualTo(t2
) || IsStrictlyBetween(t1
, t2
);
1736 inline bool wxDateTime::IsSameDate(const wxDateTime
& dt
) const
1741 return tm1
.year
== tm2
.year
&&
1742 tm1
.mon
== tm2
.mon
&&
1743 tm1
.mday
== tm2
.mday
;
1746 inline bool wxDateTime::IsSameTime(const wxDateTime
& dt
) const
1748 // notice that we can't do something like this:
1750 // m_time % MILLISECONDS_PER_DAY == dt.m_time % MILLISECONDS_PER_DAY
1752 // because we have also to deal with (possibly) different DST settings!
1756 return tm1
.hour
== tm2
.hour
&&
1757 tm1
.min
== tm2
.min
&&
1758 tm1
.sec
== tm2
.sec
&&
1759 tm1
.msec
== tm2
.msec
;
1762 inline bool wxDateTime::IsEqualUpTo(const wxDateTime
& dt
,
1763 const wxTimeSpan
& ts
) const
1765 return IsBetween(dt
.Subtract(ts
), dt
.Add(ts
));
1768 // ----------------------------------------------------------------------------
1769 // wxDateTime arithmetics
1770 // ----------------------------------------------------------------------------
1772 inline wxDateTime
wxDateTime::Add(const wxTimeSpan
& diff
) const
1774 wxASSERT_MSG( IsValid(), _T("invalid wxDateTime"));
1776 return wxDateTime(m_time
+ diff
.GetValue());
1779 inline wxDateTime
& wxDateTime::Add(const wxTimeSpan
& diff
)
1781 wxASSERT_MSG( IsValid(), _T("invalid wxDateTime"));
1783 m_time
+= diff
.GetValue();
1788 inline wxDateTime
& wxDateTime::operator+=(const wxTimeSpan
& diff
)
1793 inline wxDateTime
wxDateTime::Subtract(const wxTimeSpan
& diff
) const
1795 wxASSERT_MSG( IsValid(), _T("invalid wxDateTime"));
1797 return wxDateTime(m_time
- diff
.GetValue());
1800 inline wxDateTime
& wxDateTime::Subtract(const wxTimeSpan
& diff
)
1802 wxASSERT_MSG( IsValid(), _T("invalid wxDateTime"));
1804 m_time
-= diff
.GetValue();
1809 inline wxDateTime
& wxDateTime::operator-=(const wxTimeSpan
& diff
)
1811 return Subtract(diff
);
1814 inline wxTimeSpan
wxDateTime::Subtract(const wxDateTime
& datetime
) const
1816 wxASSERT_MSG( IsValid() && datetime
.IsValid(), _T("invalid wxDateTime"));
1818 return wxTimeSpan(GetValue() - datetime
.GetValue());
1821 inline wxTimeSpan
wxDateTime::operator-(const wxDateTime
& dt2
) const
1823 return this->Subtract(dt2
);
1826 inline wxDateTime
wxDateTime::Add(const wxDateSpan
& diff
) const
1828 return wxDateTime(*this).Add(diff
);
1831 inline wxDateTime
& wxDateTime::Subtract(const wxDateSpan
& diff
)
1833 return Add(diff
.Negate());
1836 inline wxDateTime
wxDateTime::Subtract(const wxDateSpan
& diff
) const
1838 return wxDateTime(*this).Subtract(diff
);
1841 inline wxDateTime
& wxDateTime::operator-=(const wxDateSpan
& diff
)
1843 return Subtract(diff
);
1846 inline wxDateTime
& wxDateTime::operator+=(const wxDateSpan
& diff
)
1851 // ----------------------------------------------------------------------------
1852 // wxDateTime and timezones
1853 // ----------------------------------------------------------------------------
1856 wxDateTime::ToTimezone(const wxDateTime::TimeZone
& tz
, bool noDST
) const
1858 MODIFY_AND_RETURN( MakeTimezone(tz
, noDST
) );
1861 #if wxABI_VERSION >= 20602
1864 wxDateTime::FromTimezone(const wxDateTime::TimeZone
& tz
, bool noDST
) const
1866 MODIFY_AND_RETURN( MakeFromTimezone(tz
, noDST
) );
1869 #endif // ABI >= 2.6.2
1871 // ----------------------------------------------------------------------------
1872 // wxTimeSpan construction
1873 // ----------------------------------------------------------------------------
1875 inline wxTimeSpan::wxTimeSpan(long hours
,
1880 // assign first to avoid precision loss
1887 m_diff
+= milliseconds
;
1890 // ----------------------------------------------------------------------------
1891 // wxTimeSpan accessors
1892 // ----------------------------------------------------------------------------
1894 inline wxLongLong
wxTimeSpan::GetSeconds() const
1896 return m_diff
/ 1000l;
1899 inline int wxTimeSpan::GetMinutes() const
1901 return (GetSeconds() / 60l).GetLo();
1904 inline int wxTimeSpan::GetHours() const
1906 return GetMinutes() / 60;
1909 inline int wxTimeSpan::GetDays() const
1911 return GetHours() / 24;
1914 inline int wxTimeSpan::GetWeeks() const
1916 return GetDays() / 7;
1919 // ----------------------------------------------------------------------------
1920 // wxTimeSpan arithmetics
1921 // ----------------------------------------------------------------------------
1923 inline wxTimeSpan
wxTimeSpan::Add(const wxTimeSpan
& diff
) const
1925 return wxTimeSpan(m_diff
+ diff
.GetValue());
1928 inline wxTimeSpan
& wxTimeSpan::Add(const wxTimeSpan
& diff
)
1930 m_diff
+= diff
.GetValue();
1935 inline wxTimeSpan
wxTimeSpan::Subtract(const wxTimeSpan
& diff
) const
1937 return wxTimeSpan(m_diff
- diff
.GetValue());
1940 inline wxTimeSpan
& wxTimeSpan::Subtract(const wxTimeSpan
& diff
)
1942 m_diff
-= diff
.GetValue();
1947 inline wxTimeSpan
& wxTimeSpan::Multiply(int n
)
1954 inline wxTimeSpan
wxTimeSpan::Multiply(int n
) const
1956 return wxTimeSpan(m_diff
* (long)n
);
1959 inline wxTimeSpan
wxTimeSpan::Abs() const
1961 return wxTimeSpan(GetValue().Abs());
1964 inline bool wxTimeSpan::IsEqualTo(const wxTimeSpan
& ts
) const
1966 return GetValue() == ts
.GetValue();
1969 inline bool wxTimeSpan::IsLongerThan(const wxTimeSpan
& ts
) const
1971 return GetValue().Abs() > ts
.GetValue().Abs();
1974 // ----------------------------------------------------------------------------
1976 // ----------------------------------------------------------------------------
1978 inline wxDateSpan
& wxDateSpan::operator+=(const wxDateSpan
& other
)
1980 m_years
+= other
.m_years
;
1981 m_months
+= other
.m_months
;
1982 m_weeks
+= other
.m_weeks
;
1983 m_days
+= other
.m_days
;
1988 inline wxDateSpan
& wxDateSpan::Add(const wxDateSpan
& other
)
1990 return *this += other
;
1993 inline wxDateSpan
wxDateSpan::Add(const wxDateSpan
& other
) const
1995 wxDateSpan
ds(*this);
2000 inline wxDateSpan
& wxDateSpan::Multiply(int factor
)
2010 inline wxDateSpan
wxDateSpan::Multiply(int factor
) const
2012 wxDateSpan
ds(*this);
2013 ds
.Multiply(factor
);
2017 inline wxDateSpan
wxDateSpan::Negate() const
2019 return wxDateSpan(-m_years
, -m_months
, -m_weeks
, -m_days
);
2022 inline wxDateSpan
& wxDateSpan::Neg()
2025 m_months
= -m_months
;
2032 inline wxDateSpan
& wxDateSpan::operator-=(const wxDateSpan
& other
)
2034 return *this += other
.Negate();
2037 inline wxDateSpan
& wxDateSpan::Subtract(const wxDateSpan
& other
)
2039 return *this -= other
;
2042 inline wxDateSpan
wxDateSpan::Subtract(const wxDateSpan
& other
) const
2044 wxDateSpan
ds(*this);
2049 #undef MILLISECONDS_PER_DAY
2051 #undef MODIFY_AND_RETURN
2053 // ============================================================================
2055 // ============================================================================
2057 // ----------------------------------------------------------------------------
2058 // wxTimeSpan operators
2059 // ----------------------------------------------------------------------------
2061 wxTimeSpan WXDLLIMPEXP_BASE
operator*(int n
, const wxTimeSpan
& ts
);
2063 // ----------------------------------------------------------------------------
2065 // ----------------------------------------------------------------------------
2067 wxDateSpan WXDLLIMPEXP_BASE
operator*(int n
, const wxDateSpan
& ds
);
2069 // ============================================================================
2070 // other helper functions
2071 // ============================================================================
2073 // ----------------------------------------------------------------------------
2074 // iteration helpers: can be used to write a for loop over enum variable like
2076 // for ( m = wxDateTime::Jan; m < wxDateTime::Inv_Month; wxNextMonth(m) )
2077 // ----------------------------------------------------------------------------
2079 WXDLLIMPEXP_BASE
void wxNextMonth(wxDateTime::Month
& m
);
2080 WXDLLIMPEXP_BASE
void wxPrevMonth(wxDateTime::Month
& m
);
2081 WXDLLIMPEXP_BASE
void wxNextWDay(wxDateTime::WeekDay
& wd
);
2082 WXDLLIMPEXP_BASE
void wxPrevWDay(wxDateTime::WeekDay
& wd
);
2084 #endif // wxUSE_DATETIME
2086 #endif // _WX_DATETIME_H