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