]> git.saurik.com Git - wxWidgets.git/blob - interface/datetime.h
c388f0b0b8775eb1dbd59263dc61b8c5020da90a
[wxWidgets.git] / interface / datetime.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: datetime.h
3 // Purpose: interface of wxDateTime
4 // Author: wxWidgets team
5 // RCS-ID: $Id$
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
8
9 /**
10 @class wxDateTime
11 @wxheader{datetime.h}
12
13 wxDateTime class represents an absolute moment in the time.
14
15 @library{wxbase}
16 @category{data}
17
18 @stdobjects
19 ::wxDefaultDateTime
20
21 @see @ref overview_wxdatetimeoverview "Date classes overview", wxTimeSpan,
22 wxDateSpan, wxCalendarCtrl
23 */
24 class wxDateTime
25 {
26 public:
27 /**
28 Same as @ref setdate() Set
29 */
30 wxDateTime(wxDateTime_t day, Month month = Inv_Month,
31 int year = Inv_Year, wxDateTime_t hour = 0,
32 wxDateTime_t minute = 0,
33 wxDateTime_t second = 0,
34 wxDateTime_t millisec = 0);
35
36 /**
37 Here are the trivial accessors. Other functions, which might have to perform
38 some more complicated calculations to find the answer are under the
39 @ref overview_datetimecalculations "Calendar calculations" section.
40 IsValid()
41
42 GetTicks()
43
44 GetCentury()
45
46 GetYear()
47
48 GetMonth()
49
50 GetDay()
51
52 GetWeekDay()
53
54 GetHour()
55
56 GetMinute()
57
58 GetSecond()
59
60 GetMillisecond()
61
62 GetDayOfYear()
63
64 GetWeekOfYear()
65
66 GetWeekOfMonth()
67
68 GetYearDay()
69
70 IsWorkDay()
71
72 IsGregorianDate()
73
74 GetAsDOS()
75 */
76
77
78 //@{
79 /**
80 Adds the given date span to this object.
81 */
82 wxDateTime Add(const wxDateSpan& diff);
83 const wxDateTime& Add(const wxDateSpan& diff);
84 wxDateTime operator+=(const wxDateSpan& diff);
85 //@}
86
87 /**
88 Some degree of support for the date units used in astronomy and/or history is
89 provided. You can construct a wxDateTime object from a
90 @ref setjdn() JDN and you may also get its JDN,
91 @ref getmodifiedjuliandaynumber() MJD or
92 @ref getratadie() "Rata Die number" from it.
93 @ref wxdatetimejdn() "wxDateTime(double jdn)"
94
95 @ref setjdn() "Set(double jdn)"
96
97 GetJulianDayNumber()
98
99 GetJDN()
100
101 GetModifiedJulianDayNumber()
102
103 GetMJD()
104
105 GetRataDie()
106 */
107
108
109 /**
110 The functions in this section perform the basic calendar calculations, mostly
111 related to the week days. They allow to find the given week day in the
112 week with given number (either in the month or in the year) and so on.
113 All (non-const) functions in this section don't modify the time part of the
114 wxDateTime -- they only work with the date part of it.
115 SetToWeekDayInSameWeek()
116
117 GetWeekDayInSameWeek()
118
119 SetToNextWeekDay()
120
121 GetNextWeekDay()
122
123 SetToPrevWeekDay()
124
125 GetPrevWeekDay()
126
127 SetToWeekDay()
128
129 @ref wxDateTime::getweekday2 GetWeekDay
130
131 SetToLastWeekDay()
132
133 GetLastWeekDay()
134
135 SetToWeekOfYear()
136
137 SetToLastMonthDay()
138
139 GetLastMonthDay()
140
141 SetToYearDay()
142
143 GetYearDay()
144 */
145
146
147 /**
148 Constructors and various @c Set() methods are collected here. If you
149 construct a date object from separate values for day, month and year, you
150 should use IsValid() method to check that the
151 values were correct as constructors can not return an error code.
152 @ref wxdatetimedef() wxDateTime
153
154 @ref wxdatetimetimet() wxDateTime(time_t)
155
156 @ref wxdatetimetm() "wxDateTime(struct tm)"
157
158 @ref wxdatetimejdn() "wxDateTime(double jdn)"
159
160 @ref wxdatetimetime() "wxDateTime(h, m, s, ms)"
161
162 @ref wxdatetimedate() "wxDateTime(day, mon, year, h, m, s, ms)"
163
164 SetToCurrent()
165
166 @ref settimet() Set(time_t)
167
168 @ref settm() "Set(struct tm)"
169
170 @ref setjdn() "Set(double jdn)"
171
172 @ref settime() "Set(h, m, s, ms)"
173
174 @ref setdate() "Set(day, mon, year, h, m, s, ms)"
175
176 @ref setfromdos() "SetFromDOS(unsigned long ddt)"
177
178 ResetTime()
179
180 SetYear()
181
182 SetMonth()
183
184 @ref setdate() SetDay
185
186 SetHour()
187
188 SetMinute()
189
190 SetSecond()
191
192 SetMillisecond()
193
194 @ref operatoreqtimet() operator=(time_t)
195
196 @ref operatoreqtm() "operator=(struct tm)"
197 */
198
199
200 /**
201 Converts the year in absolute notation (i.e. a number which can be negative,
202 positive or zero) to the year in BC/AD notation. For the positive years,
203 nothing is done, but the year 0 is year 1 BC and so for other years there is a
204 difference of 1.
205 This function should be used like this:
206 */
207 static int ConvertYearToBC(int year);
208
209 /**
210 These functions carry out arithmetics() on the wxDateTime
211 objects. As explained in the overview, either wxTimeSpan or wxDateSpan may be
212 added to wxDateTime, hence all functions are overloaded to accept both
213 arguments.
214 Also, both @c Add() and @c Subtract() have both const and non-const
215 version. The first one returns a new object which represents the
216 sum/difference of the original one with the argument while the second form
217 modifies the object to which it is applied. The operators -= and += are
218 defined to be equivalent to the second forms of these functions.
219 @ref addts() Add(wxTimeSpan)
220
221 @ref addds() Add(wxDateSpan)
222
223 @ref subtractts() Subtract(wxTimeSpan)
224
225 @ref subtractds() Subtract(wxDateSpan)
226
227 @ref subtractdt() Subtract(wxDateTime)
228
229 @ref addts() oparator+=(wxTimeSpan)
230
231 @ref addds() oparator+=(wxDateSpan)
232
233 @ref subtractts() oparator-=(wxTimeSpan)
234
235 @ref subtractds() oparator-=(wxDateSpan)
236 */
237
238
239 /**
240 There are several function to allow date comparison. To supplement them, a few
241 global operators , etc taking wxDateTime are defined.
242 IsEqualTo()
243
244 IsEarlierThan()
245
246 IsLaterThan()
247
248 IsStrictlyBetween()
249
250 IsBetween()
251
252 IsSameDate()
253
254 IsSameTime()
255
256 IsEqualUpTo()
257 */
258
259
260 /**
261 This function does the same as the standard ANSI C @c strftime(3) function.
262 Please see its description for the meaning of @a format parameter.
263 It also accepts a few wxWidgets-specific extensions: you can optionally specify
264 the width of the field to follow using @c printf(3)-like syntax and the
265 format specification @c %l can be used to get the number of milliseconds.
266
267 @see ParseFormat()
268 */
269 wxString Format(const wxChar* format = wxDefaultDateTimeFormat,
270 const TimeZone& tz = Local) const;
271
272 /**
273 Identical to calling Format() with @c "%x"
274 argument (which means 'preferred date representation for the current locale').
275 */
276 wxString FormatDate() const;
277
278 /**
279 Returns the combined date-time representation in the ISO 8601 format
280 (YYYY-MM-DDTHH:MM:SS). The @a sep parameter default value produces the
281 result exactly corresponding to the ISO standard, but it can also be useful to
282 use a space as seprator if a more human-readable combined date-time
283 representation is needed.
284
285 @see FormatISODate(), FormatISOTime(),
286 ParseISOCombined()
287 */
288 wxString FormatISOCombined(char sep = 'T') const;
289
290 /**
291 This function returns the date representation in the ISO 8601 format
292 (YYYY-MM-DD).
293 */
294 wxString FormatISODate() const;
295
296 /**
297 This function returns the time representation in the ISO 8601 format
298 (HH:MM:SS).
299 */
300 wxString FormatISOTime() const;
301
302 /**
303 Identical to calling Format() with @c "%X"
304 argument (which means 'preferred time representation for the current locale').
305 */
306 wxString FormatTime() const;
307
308 /**
309 Transform the date from the given time zone to the local one. If @a noDST is
310 @true, no DST adjustments will be made.
311 Returns the date in the local time zone.
312 */
313 wxDateTime FromTimezone(const TimeZone& tz,
314 bool noDST = false) const;
315
316 /**
317 Returns the translations of the strings @c AM and @c PM used for time
318 formatting for the current locale. Either of the pointers may be @NULL if
319 the corresponding value is not needed.
320 */
321 static void GetAmPmStrings(wxString* am, wxString* pm);
322
323 /**
324 Returns the date and time in
325 DOS
326 format.
327 */
328 long unsigned int GetAsDOS() const;
329
330 /**
331 Get the beginning of DST for the given country in the given year (current one
332 by default). This function suffers from limitations described in
333 @ref overview_tdatedst "DST overview".
334
335 @see GetEndDST()
336 */
337 static wxDateTime GetBeginDST(int year = Inv_Year,
338 Country country = Country_Default);
339
340 /**
341 Returns the century of this date.
342 */
343 int GetCentury(const TimeZone& tz = Local) const;
344
345 /**
346 Returns the current default country. The default country is used for DST
347 calculations, for example.
348
349 @see SetCountry()
350 */
351 static Country GetCountry();
352
353 /**
354 Get the current month in given calendar (only Gregorian is currently supported).
355 */
356 static Month GetCurrentMonth(Calendar cal = Gregorian);
357
358 /**
359 Get the current year in given calendar (only Gregorian is currently supported).
360 */
361 static int GetCurrentYear(Calendar cal = Gregorian);
362
363 /**
364 Returns the object having the same date component as this one but time of
365 00:00:00.
366
367 @wxsince{2.8.2}
368
369 @see ResetTime()
370 */
371 wxDateTime GetDateOnly() const;
372
373 /**
374 Returns the day in the given timezone (local one by default).
375 */
376 short unsigned int GetDay(const TimeZone& tz = Local) const;
377
378 /**
379 Returns the day of the year (in 1...366 range) in the given timezone
380 (local one by default).
381 */
382 short unsigned int GetDayOfYear(const TimeZone& tz = Local) const;
383
384 /**
385 Returns the end of DST for the given country in the given year (current one by
386 default).
387
388 @see GetBeginDST()
389 */
390 static wxDateTime GetEndDST(int year = Inv_Year,
391 Country country = Country_Default);
392
393 /**
394 Returns the hour in the given timezone (local one by default).
395 */
396 short unsigned int GetHour(const TimeZone& tz = Local) const;
397
398 /**
399 Synonym for GetJulianDayNumber().
400 */
401 double GetJDN() const;
402
403 /**
404 Returns the @ref setjdn() JDN corresponding to this date. Beware
405 of rounding errors!
406
407 @see GetModifiedJulianDayNumber()
408 */
409 double GetJulianDayNumber() const;
410
411 /**
412 Returns the copy of this object to which
413 SetToLastMonthDay() was applied.
414 */
415 wxDateTime GetLastMonthDay(Month month = Inv_Month,
416 int year = Inv_Year) const;
417
418 /**
419 Returns the copy of this object to which
420 SetToLastWeekDay() was applied.
421 */
422 wxDateTime GetLastWeekDay(WeekDay weekday,
423 Month month = Inv_Month,
424 int year = Inv_Year);
425
426 /**
427 Synonym for GetModifiedJulianDayNumber().
428 */
429 double GetMJD() const;
430
431 /**
432 Returns the milliseconds in the given timezone (local one by default).
433 */
434 short unsigned int GetMillisecond(const TimeZone& tz = Local) const;
435
436 /**
437 Returns the minute in the given timezone (local one by default).
438 */
439 short unsigned int GetMinute(const TimeZone& tz = Local) const;
440
441 /**
442 Returns the @e Modified Julian Day Number (MJD) which is, by definition,
443 equal to JDN - 2400000.5. The MJDs are simpler to work with as the integral
444 MJDs correspond to midnights of the dates in the Gregorian calendar and not th
445 noons like JDN. The MJD 0 is Nov 17, 1858.
446 */
447 double GetModifiedJulianDayNumber() const;
448
449 /**
450 Returns the month in the given timezone (local one by default).
451 */
452 Month GetMonth(const TimeZone& tz = Local) const;
453
454 /**
455 Gets the full (default) or abbreviated (specify @c Name_Abbr name of the
456 given month.
457
458 @see GetWeekDayName()
459 */
460 static wxString GetMonthName(Month month,
461 NameFlags flags = Name_Full);
462
463 /**
464 Returns the copy of this object to which
465 SetToNextWeekDay() was applied.
466 */
467 wxDateTime GetNextWeekDay(WeekDay weekday) const;
468
469 //@{
470 /**
471 Returns the number of days in the given year or in the given month of the
472 year.
473 The only supported value for @a cal parameter is currently @c Gregorian.
474 */
475 static wxDateTime_t GetNumberOfDays(int year,
476 Calendar cal = Gregorian);
477 static wxDateTime_t GetNumberOfDays(Month month,
478 int year = Inv_Year,
479 Calendar cal = Gregorian);
480 //@}
481
482 /**
483 Returns the copy of this object to which
484 SetToPrevWeekDay() was applied.
485 */
486 wxDateTime GetPrevWeekDay(WeekDay weekday) const;
487
488 /**
489 Return the @e Rata Die number of this date.
490 By definition, the Rata Die number is a date specified as the number of days
491 relative to a base date of December 31 of the year 0. Thus January 1 of the
492 year 1 is Rata Die day 1.
493 */
494 double GetRataDie() const;
495
496 /**
497 Returns the seconds in the given timezone (local one by default).
498 */
499 short unsigned int GetSecond(const TimeZone& tz = Local) const;
500
501 /**
502 Returns the number of seconds since Jan 1, 1970. An assert failure will occur
503 if the date is not in the range covered by @c time_t type.
504 */
505 time_t GetTicks() const;
506
507 /**
508 Returns the current time.
509 */
510 static time_t GetTimeNow();
511
512 /**
513 Returns broken down representation of the date and time.
514 */
515 Tm GetTm(const TimeZone& tz = Local) const;
516
517 /**
518 Returns the current time broken down. Note that this function returns a
519 pointer to a static buffer that's reused by calls to this function and
520 certain C library functions (e.g. localtime). If there is any chance your
521 code might be used in a multi-threaded application, you really should use
522 the flavour of function GetTmNow()
523 taking a parameter.
524 */
525 static struct tm* GetTmNow();
526
527 /**
528 Returns the copy of this object to which
529 SetToWeekDay() was applied.
530 */
531 wxDateTime GetWeekDay(WeekDay weekday, int n = 1,
532 Month month = Inv_Month,
533 int year = Inv_Year) const;
534
535 /**
536 Returns the copy of this object to which
537 SetToWeekDayInSameWeek() was
538 applied.
539 */
540 wxDateTime GetWeekDayInSameWeek(WeekDay weekday,
541 WeekFlags flags = Monday_First) const;
542
543 /**
544 Gets the full (default) or abbreviated (specify @c Name_Abbr name of the
545 given week day.
546
547 @see GetMonthName()
548 */
549 static wxString GetWeekDayName(WeekDay weekday,
550 NameFlags flags = Name_Full);
551
552 /**
553 Returns the ordinal number of the week in the month (in 1...5 range).
554 As GetWeekOfYear(), this function supports
555 both conventions for the week start. See the description of these
556 @ref overview_wxdatetime "week start" conventions.
557 */
558 wxDateTime_t GetWeekOfMonth(WeekFlags flags = Monday_First,
559 const TimeZone& tz = Local) const;
560
561 /**
562 Returns the number of the week of the year this date is in. The first week of
563 the year is, according to international standards, the one containing Jan 4 or,
564 equivalently, the first week which has Thursday in this year. Both of these
565 definitions are the same as saying that the first week of the year must contain
566 more than half of its days in this year. Accordingly, the week number will
567 always be in 1...53 range (52 for non-leap years).
568 The function depends on the @ref overview_wxdatetime "week start" convention
569 specified by the @a flags argument but its results for
570 @c Sunday_First are not well-defined as the ISO definition quoted above
571 applies to the weeks starting on Monday only.
572 */
573 wxDateTime_t GetWeekOfYear(WeekFlags flags = Monday_First,
574 const TimeZone& tz = Local) const;
575
576 /**
577 Returns the year in the given timezone (local one by default).
578 */
579 int GetYear(const TimeZone& tz = Local) const;
580
581 /**
582 Returns the copy of this object to which
583 SetToYearDay() was applied.
584 */
585 wxDateTime GetYearDay(short unsigned int) const;
586
587 /**
588 Returns @true if IsStrictlyBetween()
589 is @true or if the date is equal to one of the limit values.
590
591 @see IsStrictlyBetween()
592 */
593 bool IsBetween(const wxDateTime& t1, const wxDateTime& t2) const;
594
595 /**
596 Returns @true if the DST is applied for this date in the given country.
597 */
598 int IsDST(Country country = Country_Default) const;
599
600 /**
601 Returns @true if DST was used n the given year (the current one by
602 default) in the given country.
603 */
604 static bool IsDSTApplicable(int year = Inv_Year,
605 Country country = Country_Default);
606
607 /**
608 Returns @true if this date precedes the given one.
609 */
610 bool IsEarlierThan(const wxDateTime& datetime) const;
611
612 /**
613 Returns @true if the two dates are strictly identical.
614 */
615 bool IsEqualTo(const wxDateTime& datetime) const;
616
617 /**
618 Returns @true if the date is equal to another one up to the given time
619 interval, i.e. if the absolute difference between the two dates is less than
620 this interval.
621 */
622 bool IsEqualUpTo(const wxDateTime& dt, const wxTimeSpan& ts) const;
623
624 /**
625 Returns @true if the given date is later than the date of adoption of the
626 Gregorian calendar in the given country (and hence the Gregorian calendar
627 calculations make sense for it).
628 */
629 bool IsGregorianDate(GregorianAdoption country = Gr_Standard) const;
630
631 /**
632 Returns @true if this date is later than the given one.
633 */
634 bool IsLaterThan(const wxDateTime& datetime) const;
635
636 /**
637 Returns @true if the @a year is a leap one in the specified calendar.
638 This functions supports Gregorian and Julian calendars.
639 */
640 static bool IsLeapYear(int year = Inv_Year,
641 Calendar cal = Gregorian);
642
643 /**
644 Returns @true if the date is the same without comparing the time parts.
645 */
646 bool IsSameDate(const wxDateTime& dt) const;
647
648 /**
649 Returns @true if the time is the same (although dates may differ).
650 */
651 bool IsSameTime(const wxDateTime& dt) const;
652
653 /**
654 Returns @true if this date lies strictly between the two others,
655
656 @see IsBetween()
657 */
658 bool IsStrictlyBetween(const wxDateTime& t1,
659 const wxDateTime& t2) const;
660
661 /**
662 Returns @true if the object represents a valid time moment.
663 */
664 bool IsValid() const;
665
666 /**
667 This function returns @true if the specified (or default) country is one
668 of Western European ones. It is used internally by wxDateTime to determine the
669 DST convention and date and time formatting rules.
670 */
671 static bool IsWestEuropeanCountry(Country country = Country_Default);
672
673 /**
674 Returns @true is this day is not a holiday in the given country.
675 */
676 bool IsWorkDay(Country country = Country_Default) const;
677
678 /**
679 Same as FromTimezone() but modifies the object
680 in place.
681 */
682 wxDateTime MakeFromTimezone(const TimeZone& tz,
683 bool noDST = false);
684
685 /**
686 Modifies the object in place to represent the date in another time zone. If
687 @a noDST is @true, no DST adjustments will be made.
688 */
689 wxDateTime MakeTimezone(const TimeZone& tz,
690 bool noDST = false);
691
692 /**
693 This is the same as calling MakeTimezone() with
694 the argument @c GMT0.
695 */
696 wxDateTime& MakeUTC(bool noDST = false);
697
698 /**
699 Returns the object corresponding to the current time.
700 Example:
701
702 Note that this function is accurate up to second:
703 UNow() should be used for better precision
704 (but it is less efficient and might not be available on all platforms).
705
706 @see Today()
707 */
708 static wxDateTime Now();
709
710 //@{
711 /**
712 This function is like ParseDateTime(), but it
713 only allows the date to be specified. It is thus less flexible then
714 ParseDateTime(), but also has less chances to
715 misinterpret the user input.
716 Returns @NULL if the conversion failed, otherwise return the pointer to
717 the character which stopped the scan.
718 */
719 const char* ParseDate(const wxString& date,
720 wxString::const_iterator* end = NULL);
721 const char* ParseDate(const char* date);
722 const wchar_t* ParseDate(const wchar_t* date);
723 //@}
724
725 //@{
726 /**
727 Parses the string @a datetime containing the date and time in free format.
728 This function tries as hard as it can to interpret the given string as date
729 and time. Unlike wxDateTime::ParseRfc822Date, it
730 will accept anything that may be accepted and will only reject strings which
731 can not be parsed in any way at all.
732 Returns @NULL if the conversion failed, otherwise return the pointer to
733 the character which stopped the scan.
734 */
735 const char* ParseDateTime(const wxString& datetime,
736 wxString::const_iterator* end = NULL);
737 const char* ParseDateTime(const char* datetime);
738 const wchar_t* ParseDateTime(const wchar_t* datetime);
739 //@}
740
741 //@{
742 /**
743 This function parses the string @a date according to the given
744 @e format. The system @c strptime(3) function is used whenever available,
745 but even if it is not, this function is still implemented, although support
746 for locale-dependent format specifiers such as @c "%c", @c "%x" or @c "%X" may
747 not be perfect and GNU extensions such as @c "%z" and @c "%Z" are
748 not implemented. This function does handle the month and weekday
749 names in the current locale on all platforms, however.
750 Please see the description of the ANSI C function @c strftime(3) for the syntax
751 of the format string.
752 The @a dateDef parameter is used to fill in the fields which could not be
753 determined from the format string. For example, if the format is @c "%d" (the
754 ay of the month), the month and the year are taken from @e dateDef. If
755 it is not specified, Today() is used as the
756 default date.
757 Returns @NULL if the conversion failed, otherwise return the pointer to
758 the character which stopped the scan.
759 */
760 const char* ParseFormat(const wxString& date,
761 const wxString& format = wxDefaultDateTimeFormat,
762 const wxDateTime& dateDef = wxDefaultDateTime,
763 wxString::const_iterator* end = NULL);
764 const char* ParseFormat(const char* date,
765 const wxString& format = wxDefaultDateTimeFormat,
766 const wxDateTime& dateDef = wxDefaultDateTime);
767 const wchar_t* ParseFormat(const wchar_t* date,
768 const wxString& format = wxDefaultDateTimeFormat,
769 const wxDateTime& dateDef = wxDefaultDateTime);
770 //@}
771
772 /**
773 This function parses the string containing the date and time in ISO 8601
774 combined format (YYYY-MM-DDTHH:MM:SS). The separator between the date and time
775 parts must be equal to @a sep for the function to succeed.
776 Returns @true if the entire string was parsed successfully, @false
777 otherwise.
778 */
779 bool ParseISOCombined(const wxString& date, char sep = 'T');
780
781 /**
782 This function parses the date in ISO 8601 format (YYYY-MM-DD).
783 Returns @true if the entire string was parsed successfully, @false
784 otherwise.
785 */
786 bool ParseISODate(const wxString& date);
787
788 /**
789 This function parses the time in ISO 8601 format (HH:MM:SS).
790 Returns @true if the entire string was parsed successfully, @false
791 otherwise.
792 */
793 bool ParseISOTime(const wxString& date);
794
795 //@{
796 /**
797 Parses the string @a date looking for a date formatted according to the RFC
798 822 in it. The exact description of this format may, of course, be found in
799 the RFC (section 5), but, briefly, this is the format used in the headers of
800 Internet email messages and one of the most common strings expressing date in
801 this format may be something like @c "Sat, 18 Dec 1999 00:48:30 +0100".
802 Returns @NULL if the conversion failed, otherwise return the pointer to
803 the character immediately following the part of the string which could be
804 parsed. If the entire string contains only the date in RFC 822 format,
805 the returned pointer will be pointing to a @c NUL character.
806 This function is intentionally strict, it will return an error for any string
807 which is not RFC 822 compliant. If you need to parse date formatted in more
808 free ways, you should use ParseDateTime() or
809 ParseDate() instead.
810 */
811 const char* ParseRfc822Date(const wxString& date,
812 wxString::const_iterator* end = NULL);
813 const char* ParseRfc822Date(const char* date);
814 const wchar_t* ParseRfc822Date(const wchar_t* date);
815 //@}
816
817 //@{
818 /**
819 This functions is like ParseDateTime(), but
820 only allows the time to be specified in the input string.
821 Returns @NULL if the conversion failed, otherwise return the pointer to
822 the character which stopped the scan.
823 */
824 const char* ParseTime(const wxString& time,
825 wxString::const_iterator* end = NULL);
826 const char* ParseTime(const char* time);
827 const wchar_t* ParseTime(const wchar_t* time);
828 //@}
829
830 /**
831 These functions convert wxDateTime objects to and from text. The
832 conversions to text are mostly trivial: you can either do it using the default
833 date and time representations for the current locale (
834 FormatDate() and
835 wxDateTime::FormatTime), using the international standard
836 representation defined by ISO 8601 (
837 FormatISODate(),
838 FormatISOTime() and
839 wxDateTime::FormatISOCombined) or by specifying any
840 format at all and using Format() directly.
841 The conversions from text are more interesting, as there are much more
842 possibilities to care about. The simplest cases can be taken care of with
843 ParseFormat() which can parse any date in the
844 given (rigid) format. wxDateTime::ParseRfc822Date is
845 another function for parsing dates in predefined format -- the one of RFC 822
846 which (still...) defines the format of email messages on the Internet. This
847 format can not be described with @c strptime(3)-like format strings used by
848 Format(), hence the need for a separate function.
849 But the most interesting functions are
850 ParseTime(),
851 ParseDate() and
852 ParseDateTime(). They try to parse the date
853 ans time (or only one of them) in 'free' format, i.e. allow them to be
854 specified in any of possible ways. These functions will usually be used to
855 parse the (interactive) user input which is not bound to be in any predefined
856 format. As an example, ParseDateTime() can
857 parse the strings such as @c "tomorrow", @c "March first" and even
858 @c "next Sunday".
859 Finally notice that each of the parsing functions is available in several
860 overloads: if the input string is a narrow (@c char *) string, then a
861 narrow pointer is returned. If the input string is a wide string, a wide char
862 pointer is returned. Finally, if the input parameter is a wxString, a narrow
863 char pointer is also returned for backwards compatibility but there is also an
864 additional argument of wxString::const_iterator type in which, if it is not
865 @NULL, an iterator pointing to the end of the scanned string part is returned.
866 ParseFormat()
867
868 ParseDateTime()
869
870 ParseDate()
871
872 ParseTime()
873
874 ParseISODate()
875
876 ParseISOTime()
877
878 ParseISOCombined()
879
880 wxDateTime::ParseRfc822Date
881
882 Format()
883
884 FormatDate()
885
886 FormatTime()
887
888 FormatISOCombined()
889
890 FormatISODate()
891
892 FormatISOTime()
893 */
894
895
896 /**
897 Reset time to midnight (00:00:00) without changing the date.
898 */
899 wxDateTime& ResetTime();
900
901 /**
902 Sets the date and time from the parameters.
903 */
904 wxDateTime Set(wxDateTime_t day, Month month = Inv_Month,
905 int year = Inv_Year,
906 wxDateTime_t hour = 0,
907 wxDateTime_t minute = 0,
908 wxDateTime_t second = 0,
909 wxDateTime_t millisec = 0);
910
911 /**
912 Sets the country to use by default. This setting influences the DST
913 calculations, date formatting and other things.
914 The possible values for @a country parameter are enumerated in
915 @ref overview_wxdatetime "wxDateTime constants section".
916
917 @see GetCountry()
918 */
919 static void SetCountry(Country country);
920
921 /**
922 Sets the day without changing other date components.
923 */
924 wxDateTime& SetDay(short unsigned int);
925
926 /**
927 Sets the date from the date and time in
928 DOS
929 format.
930 */
931 wxDateTime Set(unsigned long ddt);
932
933 /**
934 Sets the hour without changing other date components.
935 */
936 wxDateTime& SetHour(short unsigned int);
937
938 /**
939 Sets the millisecond without changing other date components.
940 */
941 wxDateTime& SetMillisecond(short unsigned int);
942
943 /**
944 Sets the minute without changing other date components.
945 */
946 wxDateTime& SetMinute(short unsigned int);
947
948 /**
949 Sets the month without changing other date components.
950 */
951 wxDateTime& SetMonth(Month month);
952
953 /**
954 Sets the second without changing other date components.
955 */
956 wxDateTime& SetSecond(short unsigned int);
957
958 /**
959 Sets the date and time of to the current values. Same as assigning the result
960 of Now() to this object.
961 */
962 wxDateTime& SetToCurrent();
963
964 /**
965 Sets the date to the last day in the specified month (the current one by
966 default).
967 Returns the reference to the modified object itself.
968 */
969 wxDateTime SetToLastMonthDay(Month month = Inv_Month,
970 int year = Inv_Year);
971
972 /**
973 The effect of calling this function is the same as of calling
974 @c SetToWeekDay(-1, weekday, month, year). The date will be set to the last
975 @a weekday in the given month and year (the current ones by default).
976 Always returns @true.
977 */
978 bool SetToLastWeekDay(WeekDay weekday, Month month = Inv_Month,
979 int year = Inv_Year);
980
981 /**
982 Sets the date so that it will be the first @a weekday following the current
983 date.
984 Returns the reference to the modified object itself.
985 */
986 wxDateTime& SetToNextWeekDay(WeekDay weekday);
987
988 /**
989 Sets the date so that it will be the last @a weekday before the current
990 date.
991 Returns the reference to the modified object itself.
992 */
993 wxDateTime& SetToPrevWeekDay(WeekDay weekday);
994
995 /**
996 Sets the date to the @e n-th @a weekday in the given month of the given
997 year (the current month and year are used by default). The parameter @e n
998 may be either positive (counting from the beginning of the month) or negative
999 (counting from the end of it).
1000 For example, @c SetToWeekDay(2, wxDateTime::Wed) will set the date to the
1001 second Wednesday in the current month and
1002 @c SetToWeekDay(-1, wxDateTime::Sun) -- to the last Sunday in it.
1003 Returns @true if the date was modified successfully, @false
1004 otherwise meaning that the specified date doesn't exist.
1005 */
1006 bool SetToWeekDay(WeekDay weekday, int n = 1,
1007 Month month = Inv_Month,
1008 int year = Inv_Year);
1009
1010 /**
1011 Adjusts the date so that it will still lie in the same week as before, but its
1012 week day will be the given one.
1013 Returns the reference to the modified object itself.
1014 */
1015 wxDateTime SetToWeekDayInSameWeek(WeekDay weekday,
1016 WeekFlags flags = Monday_First);
1017
1018 /**
1019 Set the date to the given @a weekday in the week number @a numWeek of the
1020 given @a year . The number should be in range 1...53.
1021 Note that the returned date may be in a different year than the one passed to
1022 this function because both the week 1 and week 52 or 53 (for leap years)
1023 contain days from different years. See
1024 GetWeekOfYear() for the explanation of how the
1025 year weeks are counted.
1026 */
1027 static wxDateTime SetToWeekOfYear(int year, wxDateTime_t numWeek,
1028 WeekDay weekday = Mon);
1029
1030 /**
1031 Sets the date to the day number @a yday in the same year (i.e., unlike the
1032 other functions, this one does not use the current year). The day number
1033 should be in the range 1...366 for the leap years and 1...365 for
1034 the other ones.
1035 Returns the reference to the modified object itself.
1036 */
1037 wxDateTime& SetToYearDay(short unsigned int);
1038
1039 /**
1040 Sets the year without changing other date components.
1041 */
1042 wxDateTime& SetYear(int year);
1043
1044 /**
1045 For convenience, all static functions are collected here. These functions
1046 either set or return the static variables of wxDateSpan (the country), return
1047 the current moment, year, month or number of days in it, or do some general
1048 calendar-related actions.
1049 Please note that although several function accept an extra @e Calendar
1050 parameter, it is currently ignored as only the Gregorian calendar is
1051 supported. Future versions will support other calendars.
1052
1053 SetCountry()
1054
1055 GetCountry()
1056
1057 IsWestEuropeanCountry()
1058
1059 GetCurrentYear()
1060
1061 ConvertYearToBC()
1062
1063 GetCurrentMonth()
1064
1065 IsLeapYear()
1066
1067 @ref getcenturystatic() GetCentury
1068
1069 GetNumberOfDays()
1070
1071 GetNumberOfDays()
1072
1073 GetMonthName()
1074
1075 GetWeekDayName()
1076
1077 GetAmPmStrings()
1078
1079 IsDSTApplicable()
1080
1081 GetBeginDST()
1082
1083 GetEndDST()
1084
1085 Now()
1086
1087 UNow()
1088
1089 Today()
1090 */
1091
1092
1093 /**
1094 Subtracts another date from this one and returns the difference between them
1095 as wxTimeSpan.
1096 */
1097 wxTimeSpan Subtract(const wxDateTime& dt) const;
1098
1099 /**
1100 Please see the @ref overview_tdatetimezones "time zone overview" for more
1101 information about time zones. Normally, these functions should be rarely used.
1102 FromTimezone()
1103
1104 ToTimezone()
1105
1106 MakeTimezone()
1107
1108 MakeFromTimezone()
1109
1110 ToUTC()
1111
1112 MakeUTC()
1113
1114 GetBeginDST()
1115
1116 GetEndDST()
1117
1118 IsDST()
1119 */
1120
1121
1122 /**
1123 Transform the date to the given time zone. If @a noDST is @true, no
1124 DST adjustments will be made.
1125 Returns the date in the new time zone.
1126 */
1127 wxDateTime ToTimezone(const TimeZone& tz, bool noDST = false) const;
1128
1129 /**
1130 This is the same as calling ToTimezone() with
1131 the argument @c GMT0.
1132 */
1133 wxDateTime ToUTC(bool noDST = false) const;
1134
1135 /**
1136 Returns the object corresponding to the midnight of the current day (i.e. the
1137 same as Now(), but the time part is set to 0).
1138
1139 @see Now()
1140 */
1141 static wxDateTime Today();
1142
1143 /**
1144 Returns the object corresponding to the current time including the
1145 milliseconds if a function to get time with such precision is available on the
1146 current platform (supported under most Unices and Win32).
1147
1148 @see Now()
1149 */
1150 static wxDateTime UNow();
1151
1152 /**
1153 Same as @ref settm() Set.
1154 */
1155 wxDateTime operator(const struct tm& tm);
1156 };
1157
1158 /**
1159 Global instance of an empty wxDateTime object.
1160
1161 @todo wouldn't be better to rename it wxNullDateTime as for the rest of wx global objects
1162 which are initialized to an empty value?
1163 */
1164 wxDateTime wxDefaultDateTime;
1165
1166
1167
1168 /**
1169 @class wxDateTimeWorkDays
1170 @wxheader{datetime.h}
1171
1172
1173 @library{wxbase}
1174 @category{FIXME}
1175 */
1176 class wxDateTimeWorkDays
1177 {
1178 public:
1179
1180 };
1181
1182
1183
1184 /**
1185 @class wxDateSpan
1186 @wxheader{datetime.h}
1187
1188 This class is a "logical time span" and is useful for implementing program
1189 logic for such things as "add one month to the date" which, in general,
1190 doesn't mean to add 60*60*24*31 seconds to it, but to take the same date
1191 the next month (to understand that this is indeed different consider adding
1192 one month to Feb, 15 -- we want to get Mar, 15, of course).
1193
1194 When adding a month to the date, all lesser components (days, hours, ...)
1195 won't be changed unless the resulting date would be invalid: for example,
1196 Jan 31 + 1 month will be Feb 28, not (non-existing) Feb 31.
1197
1198 Because of this feature, adding and subtracting back again the same
1199 wxDateSpan will @b not, in general give back the original date: Feb 28 - 1
1200 month will be Jan 28, not Jan 31!
1201
1202 wxDateSpan objects can be either positive or negative. They may be
1203 multiplied by scalars which multiply all deltas by the scalar: i.e.
1204 2*(1 month and 1 day) is 2 months and 2 days. They can
1205 be added together and with wxDateTime or
1206 wxTimeSpan, but the type of result is different for each
1207 case.
1208
1209 Beware about weeks: if you specify both weeks and days, the total number of
1210 days added will be 7*weeks + days! See also GetTotalDays()
1211 function.
1212
1213 Equality operators are defined for wxDateSpans. Two datespans are equal if
1214 and only if they both give the same target date when added to @b every
1215 source date. Thus wxDateSpan::Months(1) is not equal to wxDateSpan::Days(30),
1216 because they don't give the same date when added to 1 Feb. But
1217 wxDateSpan::Days(14) is equal to wxDateSpan::Weeks(2)
1218
1219 Finally, notice that for adding hours, minutes and so on you don't need this
1220 class at all: wxTimeSpan will do the job because there
1221 are no subtleties associated with those (we don't support leap seconds).
1222
1223 @library{wxbase}
1224 @category{data}
1225
1226 @see @ref overview_wxdatetimeoverview "Date classes overview", wxDateTime
1227 */
1228 class wxDateSpan
1229 {
1230 public:
1231 /**
1232 Constructs the date span object for the given number of years, months, weeks
1233 and days. Note that the weeks and days add together if both are given.
1234 */
1235 wxDateSpan(int years = 0, int months = 0, int weeks = 0,
1236 int days = 0);
1237
1238 //@{
1239 /**
1240 Returns the sum of two date spans. The first version returns a new object, the
1241 second and third ones modify this object in place.
1242 */
1243 wxDateSpan Add(const wxDateSpan& other);
1244 const wxDateSpan& Add(const wxDateSpan& other);
1245 wxDateSpan operator+=(const wxDateSpan& other);
1246 //@}
1247
1248 /**
1249 Returns a date span object corresponding to one day.
1250
1251 @see Days()
1252 */
1253 static wxDateSpan Day();
1254
1255 /**
1256 Returns a date span object corresponding to the given number of days.
1257
1258 @see Day()
1259 */
1260 static wxDateSpan Days(int days);
1261
1262 /**
1263 Returns the number of days (only, that it not counting the weeks component!)
1264 in this date span.
1265
1266 @see GetTotalDays()
1267 */
1268 int GetDays() const;
1269
1270 /**
1271 Returns the number of the months (not counting the years) in this date span.
1272 */
1273 int GetMonths() const;
1274
1275 /**
1276 Returns the combined number of days in this date span, counting both weeks and
1277 days. It still doesn't take neither months nor years into the account.
1278
1279 @see GetWeeks(), GetDays()
1280 */
1281 int GetTotalDays() const;
1282
1283 /**
1284 Returns the number of weeks in this date span.
1285
1286 @see GetTotalDays()
1287 */
1288 int GetWeeks() const;
1289
1290 /**
1291 Returns the number of years in this date span.
1292 */
1293 int GetYears() const;
1294
1295 /**
1296 Returns a date span object corresponding to one month.
1297
1298 @see Months()
1299 */
1300 static wxDateSpan Month();
1301
1302 /**
1303 Returns a date span object corresponding to the given number of months.
1304
1305 @see Month()
1306 */
1307 static wxDateSpan Months(int mon);
1308
1309 //@{
1310 /**
1311 Returns the product of the date span by the specified @e factor. The
1312 product is computed by multiplying each of the components by the factor.
1313 The first version returns a new object, the second and third ones modify this
1314 object in place.
1315 */
1316 wxDateSpan Multiply(int factor);
1317 const wxDateSpan& Multiply(int factor);
1318 wxDateSpan operator*=(int factor);
1319 //@}
1320
1321 //@{
1322 /**
1323 Changes the sign of this date span.
1324
1325 @see Negate()
1326 */
1327 wxDateSpan Neg();
1328 wxDateSpan operator-();
1329 //@}
1330
1331 /**
1332 Returns the date span with the opposite sign.
1333
1334 @see Neg()
1335 */
1336 wxDateSpan Negate() const;
1337
1338 /**
1339 Sets the number of days (without modifying any other components) in this date
1340 span.
1341 */
1342 wxDateSpan& SetDays(int n);
1343
1344 /**
1345 Sets the number of months (without modifying any other components) in this
1346 date span.
1347 */
1348 wxDateSpan& SetMonths(int n);
1349
1350 /**
1351 Sets the number of weeks (without modifying any other components) in this date
1352 span.
1353 */
1354 wxDateSpan& SetWeeks(int n);
1355
1356 /**
1357 Sets the number of years (without modifying any other components) in this date
1358 span.
1359 */
1360 wxDateSpan& SetYears(int n);
1361
1362 //@{
1363 /**
1364 Returns the difference of two date spans. The first version returns a new
1365 object, the second and third ones modify this object in place.
1366 */
1367 wxDateSpan Subtract(const wxDateSpan& other);
1368 const wxDateSpan& Subtract(const wxDateSpan& other);
1369 wxDateSpan operator+=(const wxDateSpan& other);
1370 //@}
1371
1372 /**
1373 Returns a date span object corresponding to one week.
1374
1375 @see Weeks()
1376 */
1377 static wxDateSpan Week();
1378
1379 /**
1380 Returns a date span object corresponding to the given number of weeks.
1381
1382 @see Week()
1383 */
1384 static wxDateSpan Weeks(int weeks);
1385
1386 /**
1387 Returns a date span object corresponding to one year.
1388
1389 @see Years()
1390 */
1391 static wxDateSpan Year();
1392
1393 /**
1394 Returns a date span object corresponding to the given number of years.
1395
1396 @see Year()
1397 */
1398 static wxDateSpan Years(int years);
1399
1400 /**
1401 Returns @true if this date span is different from the other one.
1402 */
1403 bool operator!=(const wxDateSpan&) const;
1404
1405 /**
1406 Returns @true if this date span is equal to the other one. Two date spans
1407 are considered equal if and only if they have the same number of years and
1408 months and the same total number of days (counting both days and weeks).
1409 */
1410 bool operator==(const wxDateSpan&) const;
1411 };
1412
1413
1414
1415 /**
1416 @class wxTimeSpan
1417 @wxheader{datetime.h}
1418
1419 wxTimeSpan class represents a time interval.
1420
1421 @library{wxbase}
1422 @category{data}
1423
1424 @see @ref overview_wxdatetimeoverview "Date classes overview", wxDateTime
1425 */
1426 class wxTimeSpan
1427 {
1428 public:
1429 //@{
1430 /**
1431 Constructs timespan from separate values for each component, with the date
1432 set to 0. Hours are not restricted to 0..24 range, neither are
1433 minutes, seconds or milliseconds.
1434 */
1435 wxTimeSpan();
1436 wxTimeSpan(long hours, long min, long sec, long msec);
1437 //@}
1438
1439 /**
1440 Returns the absolute value of the timespan: does not modify the
1441 object.
1442 */
1443 wxTimeSpan Abs() const;
1444
1445 /**
1446 GetSeconds()
1447
1448 GetMinutes()
1449
1450 GetHours()
1451
1452 GetDays()
1453
1454 GetWeeks()
1455
1456 GetValue()
1457 */
1458
1459
1460 //@{
1461 /**
1462 Returns the sum of two timespans.
1463 */
1464 wxTimeSpan Add(const wxTimeSpan& diff);
1465 const wxTimeSpan& Add(const wxTimeSpan& diff);
1466 wxTimeSpan operator+=(const wxTimeSpan& diff);
1467 //@}
1468
1469 /**
1470 @ref ctor() wxTimeSpan
1471 */
1472
1473
1474 /**
1475 Returns the timespan for one day.
1476 */
1477 static wxTimespan Day();
1478
1479 /**
1480 Returns the timespan for the given number of days.
1481 */
1482 static wxTimespan Days(long days);
1483
1484 /**
1485 Returns the string containing the formatted representation of the time span.
1486 The following format specifiers are allowed after %:
1487
1488 H
1489
1490 number of @b Hours
1491
1492 M
1493
1494 number of @b Minutes
1495
1496 S
1497
1498 number of @b Seconds
1499
1500 l
1501
1502 number of mi@b lliseconds
1503
1504 D
1505
1506 number of @b Days
1507
1508 E
1509
1510 number of w@b Eeks
1511
1512 %
1513
1514 the percent character
1515
1516 Note that, for example, the number of hours in the description above is not
1517 well defined: it can be either the total number of hours (for example, for a
1518 time span of 50 hours this would be 50) or just the hour part of the time
1519 span, which would be 2 in this case as 50 hours is equal to 2 days and
1520 2 hours.
1521 wxTimeSpan resolves this ambiguity in the following way: if there had been,
1522 indeed, the @c %D format specified preceding the @c %H, then it is
1523 interpreted as 2. Otherwise, it is 50.
1524 The same applies to all other format specifiers: if they follow a specifier of
1525 larger unit, only the rest part is taken, otherwise the full value is used.
1526 */
1527 wxString Format(const wxString& = wxDefaultTimeSpanFormat) const;
1528
1529 /**
1530 Format()
1531 */
1532
1533
1534 /**
1535 Returns the difference in number of days.
1536 */
1537 int GetDays() const;
1538
1539 /**
1540 Returns the difference in number of hours.
1541 */
1542 int GetHours() const;
1543
1544 /**
1545 Returns the difference in number of milliseconds.
1546 */
1547 wxLongLong GetMilliseconds() const;
1548
1549 /**
1550 Returns the difference in number of minutes.
1551 */
1552 int GetMinutes() const;
1553
1554 /**
1555 Returns the difference in number of seconds.
1556 */
1557 wxLongLong GetSeconds() const;
1558
1559 /**
1560 Returns the internal representation of timespan.
1561 */
1562 wxLongLong GetValue() const;
1563
1564 /**
1565 Returns the difference in number of weeks.
1566 */
1567 int GetWeeks() const;
1568
1569 /**
1570 Returns the timespan for one hour.
1571 */
1572 static wxTimespan Hour();
1573
1574 /**
1575 Returns the timespan for the given number of hours.
1576 */
1577 static wxTimespan Hours(long hours);
1578
1579 /**
1580 Returns @true if two timespans are equal.
1581 */
1582 bool IsEqualTo(const wxTimeSpan& ts) const;
1583
1584 /**
1585 Compares two timespans: works with the absolute values, i.e. -2
1586 hours is longer than 1 hour. Also, it will return @false if
1587 the timespans are equal in absolute value.
1588 */
1589 bool IsLongerThan(const wxTimeSpan& ts) const;
1590
1591 /**
1592 Returns @true if the timespan is negative.
1593 */
1594 bool IsNegative() const;
1595
1596 /**
1597 Returns @true if the timespan is empty.
1598 */
1599 bool IsNull() const;
1600
1601 /**
1602 Returns @true if the timespan is positive.
1603 */
1604 bool IsPositive() const;
1605
1606 /**
1607 Compares two timespans: works with the absolute values, i.e. 1
1608 hour is shorter than -2 hours. Also, it will return @false if
1609 the timespans are equal in absolute value.
1610 */
1611 bool IsShorterThan(const wxTimeSpan& ts) const;
1612
1613 /**
1614 Returns the timespan for one millisecond.
1615 */
1616 static wxTimespan Millisecond();
1617
1618 /**
1619 Returns the timespan for the given number of milliseconds.
1620 */
1621 static wxTimespan Milliseconds(long ms);
1622
1623 /**
1624 Returns the timespan for one minute.
1625 */
1626 static wxTimespan Minute();
1627
1628 /**
1629 Returns the timespan for the given number of minutes.
1630 */
1631 static wxTimespan Minutes(long min);
1632
1633 //@{
1634 /**
1635 Multiplies timespan by a scalar.
1636 */
1637 wxTimeSpan Multiply(int n);
1638 const wxTimeSpan& Multiply(int n);
1639 wxTimeSpan operator*=(int n);
1640 //@}
1641
1642 //@{
1643 /**
1644 Negate the value of the timespan.
1645 */
1646 wxTimeSpan Neg();
1647 wxTimeSpan operator-();
1648 //@}
1649
1650 /**
1651 Returns timespan with inverted sign.
1652 */
1653 wxTimeSpan Negate() const;
1654
1655 /**
1656 Add()
1657
1658 Subtract()
1659
1660 Multiply()
1661
1662 Negate()
1663
1664 Neg()
1665
1666 Abs()
1667 */
1668
1669
1670 /**
1671 Returns the timespan for one second.
1672 */
1673 static wxTimespan Second();
1674
1675 /**
1676 Returns the timespan for the given number of seconds.
1677 */
1678 static wxTimespan Seconds(long sec);
1679
1680 /**
1681 Milliseconds()
1682
1683 Millisecond()
1684
1685 Seconds()
1686
1687 Second()
1688
1689 Minutes()
1690
1691 Minute()
1692
1693 Hours()
1694
1695 Hour()
1696
1697 Days()
1698
1699 Day()
1700
1701 Weeks()
1702
1703 Week()
1704 */
1705
1706
1707 //@{
1708 /**
1709 Returns the difference of two timespans.
1710 */
1711 wxTimeSpan Subtract(const wxTimeSpan& diff);
1712 const wxTimeSpan& Subtract(const wxTimeSpan& diff);
1713 wxTimeSpan operator-=(const wxTimeSpan& diff);
1714 //@}
1715
1716 /**
1717 IsNull()
1718
1719 IsPositive()
1720
1721 IsNegative()
1722
1723 IsEqualTo()
1724
1725 IsLongerThan()
1726
1727 IsShorterThan()
1728 */
1729
1730
1731 /**
1732 Returns the timespan for one week.
1733 */
1734 static wxTimespan Week();
1735
1736 /**
1737 Returns the timespan for the given number of weeks.
1738 */
1739 static wxTimespan Weeks(long weeks);
1740 };
1741
1742
1743
1744 /**
1745 @class wxDateTimeHolidayAuthority
1746 @wxheader{datetime.h}
1747
1748
1749 @library{wxbase}
1750 @category{FIXME}
1751 */
1752 class wxDateTimeHolidayAuthority
1753 {
1754 public:
1755
1756 };
1757