1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 %% Purpose: wxDateTime documentation
4 %% Author: Vadim Zeitlin
8 %% Copyright: (c) Vadim Zeitlin
9 %% License: wxWindows license
10 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12 \section{\class{wxDateTime
}}\label{wxdatetime
}
14 wxDateTime class represents an absolute moment in the time.
18 The type
{\tt wxDateTime
\_t} is typedefed as
{\tt unsigned short
} and is used
19 to contain the number of years, hours, minutes, seconds and milliseconds.
23 Global constant
{\tt wxDefaultDateTime
} and synonym for it
{\tt wxInvalidDateTime
} are defined. This constant will be different from any valid
26 All the following constants are defined inside wxDateTime class (i.e., to refer to
27 them you should prepend their names with
{\tt wxDateTime::
}).
29 Time zone symbolic names:
34 // the time in the current time zone
37 // zones from GMT (= Greenwhich Mean Time): they're guaranteed to be
38 // consequent numbers, so writing something like `GMT0 + offset' is
39 // safe if abs(offset) <=
12
41 // underscore stands for minus
42 GMT_12, GMT_11, GMT_10, GMT_9, GMT_8, GMT_7,
43 GMT_6, GMT_5, GMT_4, GMT_3, GMT_2, GMT_1,
45 GMT1, GMT2, GMT3, GMT4, GMT5, GMT6,
46 GMT7, GMT8, GMT9, GMT10, GMT11, GMT12, GMT13,
47 // Note that GMT12 and GMT_12 are not the same: there is a difference
48 // of exactly one day between them
50 // some symbolic names for TZ
53 WET = GMT0, // Western Europe Time
54 WEST = GMT1, // Western Europe Summer Time
55 CET = GMT1, // Central Europe Time
56 CEST = GMT2, // Central Europe Summer Time
57 EET = GMT2, // Eastern Europe Time
58 EEST = GMT3, // Eastern Europe Summer Time
59 MSK = GMT3, // Moscow Time
60 MSD = GMT4, // Moscow Summer Time
63 AST = GMT_4, // Atlantic Standard Time
64 ADT = GMT_3, // Atlantic Daylight Time
65 EST = GMT_5, // Eastern Standard Time
66 EDT = GMT_4, // Eastern Daylight Saving Time
67 CST = GMT_6, // Central Standard Time
68 CDT = GMT_5, // Central Daylight Saving Time
69 MST = GMT_7, // Mountain Standard Time
70 MDT = GMT_6, // Mountain Daylight Saving Time
71 PST = GMT_8, // Pacific Standard Time
72 PDT = GMT_7, // Pacific Daylight Saving Time
73 HST = GMT_10, // Hawaiian Standard Time
74 AKST = GMT_9, // Alaska Standard Time
75 AKDT = GMT_8, // Alaska Daylight Saving Time
79 A_WST = GMT8, // Western Standard Time
80 A_CST = GMT13 +
1, // Central Standard Time (+
9.5)
81 A_EST = GMT10, // Eastern Standard Time
82 A_ESST = GMT11, // Eastern Summer Time
85 NZST = GMT12, // Standard Time
86 NZDT = GMT13, // Daylight Saving Time
88 // Universal Coordinated Time = the new and politically correct name
94 Month names: Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec and
95 Inv
\_Month for an invalid.month value are the values of
{\tt wxDateTime::Month
}
98 Likewise, Sun, Mon, Tue, Wed, Thu, Fri, Sat, and Inv
\_WeekDay are the values in
99 {\tt wxDateTime::WeekDay
} enum.
101 Finally, Inv
\_Year is defined to be an invalid value for year parameter.
103 \helpref{GetMonthName()
}{wxdatetimegetmonthname
} and
104 \helpref{GetWeekDayName
}{wxdatetimegetweekdayname
} functions use the following
110 Name_Full =
0x01, // return full name
111 Name_Abbr =
0x02 // return abbreviated name
115 Several functions accept an extra parameter specifying the calendar to use
116 (although most of them only support now the Gregorian calendar). This
117 parameters is one of the following values:
122 Gregorian, // calendar currently in use in Western countries
123 Julian // calendar in use since -
45 until the
1582 (or later)
127 Date calculations often depend on the country and wxDateTime allows to set the
128 country whose conventions should be used using
129 \helpref{SetCountry
}{wxdatetimesetcountry
}. It takes one of the following
135 Country_Unknown, // no special information for this country
136 Country_Default, // set the default country with SetCountry() method
137 // or use the default country with any other
139 Country_WesternEurope_Start,
140 Country_EEC = Country_WesternEurope_Start,
144 Country_WesternEurope_End = UK,
152 Different parts of the world use different conventions for the week start.
153 In some countries, the week starts on Sunday, while in others -- on Monday.
154 The ISO standard doesn't address this issue, so we support both conventions in
155 the functions whose result depends on it (
\helpref{GetWeekOfYear
}{wxdatetimegetweekofyear
} and
156 \helpref{GetWeekOfMonth
}{wxdatetimegetweekofmonth
}).
158 The desired behvaiour may be specified by giving one of the following
159 constants as argument to these functions:
164 Default_First, // Sunday_First for US, Monday_First for the rest
165 Monday_First, // week starts with a Monday
166 Sunday_First // week starts with a Sunday
170 \wxheading{Derived from
}
174 \wxheading{Include files
}
180 \helpref{wxBase
}{librarieslist
}
184 \helpref{Date classes overview
}{wxdatetimeoverview
},
\rtfsp
185 \helpref{wxTimeSpan
}{wxtimespan
},
\rtfsp
186 \helpref{wxDateSpan
}{wxdatespan
},
\rtfsp
187 \helpref{wxCalendarCtrl
}{wxcalendarctrl
}
189 \latexignore{\rtfignore{\wxheading{Function groups
}}}
192 \membersection{Static functions
}\label{datetimestaticfunctions
}
194 For convenience, all static functions are collected here. These functions
195 either set or return the static variables of wxDateSpan (the country), return
196 the current moment, year, month or number of days in it, or do some general
197 calendar-related actions.
199 Please note that although several function accept an extra
{\it Calendar
}
200 parameter, it is currently ignored as only the Gregorian calendar is
201 supported. Future versions will support other calendars.
203 \pythonnote{These methods are standalone functions named
204 {\tt wxDateTime
\_<StaticMethodName>
} in wxPython.
}
206 \helpref{SetCountry
}{wxdatetimesetcountry
}\\
207 \helpref{GetCountry
}{wxdatetimegetcountry
}\\
208 \helpref{IsWestEuropeanCountry
}{wxdatetimeiswesteuropeancountry
}\\
209 \helpref{GetCurrentYear
}{wxdatetimegetcurrentyear
}\\
210 \helpref{ConvertYearToBC
}{wxdatetimeconvertyeartobc
}\\
211 \helpref{GetCurrentMonth
}{wxdatetimegetcurrentmonth
}\\
212 \helpref{IsLeapYear
}{wxdatetimeisleapyear
}\\
213 \helpref{GetCentury
}{wxdatetimegetcenturystatic
}\\
214 \helpref{GetNumberOfDays
}{wxdatetimegetnumberofdays
}\\
215 \helpref{GetNumberOfDays
}{wxdatetimegetnumberofdays
}\\
216 \helpref{GetMonthName
}{wxdatetimegetmonthname
}\\
217 \helpref{GetWeekDayName
}{wxdatetimegetweekdayname
}\\
218 \helpref{GetAmPmStrings
}{wxdatetimegetampmstrings
}\\
219 \helpref{IsDSTApplicable
}{wxdatetimeisdstapplicable
}\\
220 \helpref{GetBeginDST
}{wxdatetimegetbegindst
}\\
221 \helpref{GetEndDST
}{wxdatetimegetenddst
}\\
222 \helpref{Now
}{wxdatetimenow
}\\
223 \helpref{UNow
}{wxdatetimeunow
}\\
224 \helpref{Today
}{wxdatetimetoday
}
227 \membersection{Constructors, assignment operators and setters
}\label{datetimeconstructors
}
229 Constructors and various
{\tt Set()
} methods are collected here. If you
230 construct a date object from separate values for day, month and year, you
231 should use
\helpref{IsValid
}{wxdatetimeisvalid
} method to check that the
232 values were correct as constructors can not return an error code.
234 \helpref{wxDateTime()
}{wxdatetimewxdatetimedef
}\\
235 \helpref{wxDateTime(time
\_t)
}{wxdatetimewxdatetimetimet
}\\
236 \helpref{wxDateTime(struct tm)
}{wxdatetimewxdatetimetm
}\\
237 %\helpref{wxDateTime(struct Tm)}{wxdatetimewxdatetimetm} - Tm not documented yet\\
238 \helpref{wxDateTime(double jdn)
}{wxdatetimewxdatetimejdn
}\\
239 \helpref{wxDateTime(h, m, s, ms)
}{wxdatetimewxdatetimetime
}\\
240 \helpref{wxDateTime(day, mon, year, h, m, s, ms)
}{wxdatetimewxdatetimedate
}\\
241 \helpref{SetToCurrent
}{wxdatetimesettocurrent
}\\
242 \helpref{Set(time
\_t)
}{wxdatetimesettimet
}\\
243 \helpref{Set(struct tm)
}{wxdatetimesettm
}\\
244 %\helpref{Set(struct Tm)}{wxdatetimesettm} - Tm not documented yet\\
245 \helpref{Set(double jdn)
}{wxdatetimesetjdn
}\\
246 \helpref{Set(h, m, s, ms)
}{wxdatetimesettime
}\\
247 \helpref{Set(day, mon, year, h, m, s, ms)
}{wxdatetimesetdate
}\\
248 \helpref{SetFromDOS(unsigned long ddt)
}{wxdatetimesetfromdos
}\\
249 \helpref{ResetTime
}{wxdatetimeresettime
}\\
250 \helpref{SetYear
}{wxdatetimesetyear
}\\
251 \helpref{SetMonth
}{wxdatetimesetmonth
}\\
252 \helpref{SetDay
}{wxdatetimesetdate
}\\
253 \helpref{SetHour
}{wxdatetimesethour
}\\
254 \helpref{SetMinute
}{wxdatetimesetminute
}\\
255 \helpref{SetSecond
}{wxdatetimesetsecond
}\\
256 \helpref{SetMillisecond
}{wxdatetimesetmillisecond
}\\
257 \helpref{operator$=$(time
\_t)
}{wxdatetimeoperatoreqtimet
}\\
258 \helpref{operator$=$(struct tm)
}{wxdatetimeoperatoreqtm
}\rtfsp
261 \membersection{Accessors
}\label{datetimeaccessors
}
263 Here are the trivial accessors. Other functions, which might have to perform
264 some more complicated calculations to find the answer are under the
265 \helpref{Calendar calculations
}{datetimecalculations
} section.
267 \helpref{IsValid
}{wxdatetimeisvalid
}\\
268 \helpref{GetTicks
}{wxdatetimegetticks
}\\
269 \helpref{GetCentury
}{wxdatetimegetcentury
}\\
270 \helpref{GetYear
}{wxdatetimegetyear
}\\
271 \helpref{GetMonth
}{wxdatetimegetmonth
}\\
272 \helpref{GetDay
}{wxdatetimegetday
}\\
273 \helpref{GetWeekDay
}{wxdatetimegetweekday
}\\
274 \helpref{GetHour
}{wxdatetimegethour
}\\
275 \helpref{GetMinute
}{wxdatetimegetminute
}\\
276 \helpref{GetSecond
}{wxdatetimegetsecond
}\\
277 \helpref{GetMillisecond
}{wxdatetimegetmillisecond
}\\
278 \helpref{GetDayOfYear
}{wxdatetimegetdayofyear
}\\
279 \helpref{GetWeekOfYear
}{wxdatetimegetweekofyear
}\\
280 \helpref{GetWeekOfMonth
}{wxdatetimegetweekofmonth
}\\
281 \helpref{GetYearDay
}{wxdatetimegetyearday
}\\
282 \helpref{IsWorkDay
}{wxdatetimeisworkday
}\\
283 \helpref{IsGregorianDate
}{wxdatetimeisgregoriandate
}\\
284 \helpref{GetAsDOS
}{wxdatetimegetasdos
}
287 \membersection{Date comparison
}\label{datecomparison
}
289 There are several function to allow date comparison. To supplement them, a few
290 global operators $>$, $<$ etc taking wxDateTime are defined.
292 \helpref{IsEqualTo
}{wxdatetimeisequalto
}\\
293 \helpref{IsEarlierThan
}{wxdatetimeisearlierthan
}\\
294 \helpref{IsLaterThan
}{wxdatetimeislaterthan
}\\
295 \helpref{IsStrictlyBetween
}{wxdatetimeisstrictlybetween
}\\
296 \helpref{IsBetween
}{wxdatetimeisbetween
}\\
297 \helpref{IsSameDate
}{wxdatetimeissamedate
}\\
298 \helpref{IsSameTime
}{wxdatetimeissametime
}\\
299 \helpref{IsEqualUpTo
}{wxdatetimeisequalupto
}
302 \membersection{Date arithmetics
}\label{datearithmetics
}
304 These functions carry out
\helpref{arithmetics
}{tdatearithm
} on the wxDateTime
305 objects. As explained in the overview, either wxTimeSpan or wxDateSpan may be
306 added to wxDateTime, hence all functions are overloaded to accept both
309 Also, both
{\tt Add()
} and
{\tt Subtract()
} have both const and non-const
310 version. The first one returns a new object which represents the
311 sum/difference of the original one with the argument while the second form
312 modifies the object to which it is applied. The operators $-=$ and $+=$ are
313 defined to be equivalent to the second forms of these functions.
315 \helpref{Add(wxTimeSpan)
}{wxdatetimeaddts
}\\
316 \helpref{Add(wxDateSpan)
}{wxdatetimeaddds
}\\
317 \helpref{Subtract(wxTimeSpan)
}{wxdatetimesubtractts
}\\
318 \helpref{Subtract(wxDateSpan)
}{wxdatetimesubtractds
}\\
319 \helpref{Subtract(wxDateTime)
}{wxdatetimesubtractdt
}\\
320 \helpref{oparator$+=$(wxTimeSpan)
}{wxdatetimeaddts
}\\
321 \helpref{oparator$+=$(wxDateSpan)
}{wxdatetimeaddds
}\\
322 \helpref{oparator$-=$(wxTimeSpan)
}{wxdatetimesubtractts
}\\
323 \helpref{oparator$-=$(wxDateSpan)
}{wxdatetimesubtractds
}
326 \membersection{Parsing and formatting dates
}\label{datetimeparsing
}
328 These functions convert wxDateTime objects to and from text. The
329 conversions to text are mostly trivial: you can either do it using the default
330 date and time representations for the current locale (
331 \helpref{FormatDate
}{wxdatetimeformatdate
} and
332 \helpref{FormatTime
}{wxdatetimeformattime
}), using the international standard
333 representation defined by ISO
8601 (
334 \helpref{FormatISODate
}{wxdatetimeformatisodate
} and
335 \helpref{FormatISOTime
}{wxdatetimeformatisotime
}) or by specifying any format
336 at all and using
\helpref{Format
}{wxdatetimeformat
} directly.
338 The conversions from text are more interesting, as there are much more
339 possibilities to care about. The simplest cases can be taken care of with
340 \helpref{ParseFormat
}{wxdatetimeparseformat
} which can parse any date in the
341 given (rigid) format.
\helpref{ParseRfc822Date
}{wxdatetimeparserfc822date
} is
342 another function for parsing dates in predefined format -- the one of RFC
822
343 which (still...) defines the format of email messages on the Internet. This
344 format can not be described with
{\tt strptime(
3)
}-like format strings used by
345 \helpref{Format
}{wxdatetimeformat
}, hence the need for a separate function.
347 But the most interesting functions are
348 \helpref{ParseTime
}{wxdatetimeparsetime
},
349 \helpref{ParseDate
}{wxdatetimeparsedate
} and
350 \helpref{ParseDateTime
}{wxdatetimeparsedatetime
}. They try to parse the date
351 ans time (or only one of them) in `free' format, i.e. allow them to be
352 specified in any of possible ways. These functions will usually be used to
353 parse the (interactive) user input which is not bound to be in any predefined
354 format. As an example,
\helpref{ParseDateTime
}{wxdatetimeparsedatetime
} can
355 parse the strings such as
{\tt "tomorrow"
},
{\tt "March first"
} and even
358 \helpref{ParseRfc822Date
}{wxdatetimeparserfc822date
}\\
359 \helpref{ParseFormat
}{wxdatetimeparseformat
}\\
360 \helpref{ParseDateTime
}{wxdatetimeparsedatetime
}\\
361 \helpref{ParseDate
}{wxdatetimeparsedate
}\\
362 \helpref{ParseTime
}{wxdatetimeparsetime
}\\
363 \helpref{Format
}{wxdatetimeformat
}\\
364 \helpref{FormatDate
}{wxdatetimeformatdate
}\\
365 \helpref{FormatTime
}{wxdatetimeformattime
}\\
366 \helpref{FormatISODate
}{wxdatetimeformatisodate
}\\
367 \helpref{FormatISOTime
}{wxdatetimeformatisotime
}
370 \membersection{Calendar calculations
}\label{datetimecalculations
}
372 The functions in this section perform the basic calendar calculations, mostly
373 related to the week days. They allow to find the given week day in the
374 week with given number (either in the month or in the year) and so on.
376 All (non-const) functions in this section don't modify the time part of the
377 wxDateTime -- they only work with the date part of it.
379 \helpref{SetToWeekDayInSameWeek
}{wxdatetimesettoweekdayinsameweek
}\\
380 \helpref{GetWeekDayInSameWeek
}{wxdatetimegetweekdayinsameweek
}\\
381 \helpref{SetToNextWeekDay
}{wxdatetimesettonextweekday
}\\
382 \helpref{GetNextWeekDay
}{wxdatetimegetnextweekday
}\\
383 \helpref{SetToPrevWeekDay
}{wxdatetimesettoprevweekday
}\\
384 \helpref{GetPrevWeekDay
}{wxdatetimegetprevweekday
}\\
385 \helpref{SetToWeekDay
}{wxdatetimesettoweekday
}\\
386 \helpref{GetWeekDay
}{wxdatetimegetweekday2
}\\
387 \helpref{SetToLastWeekDay
}{wxdatetimesettolastweekday
}\\
388 \helpref{GetLastWeekDay
}{wxdatetimegetlastweekday
}\\
389 \helpref{SetToWeekOfYear
}{wxdatetimesettoweekofyear
}\\
390 \helpref{SetToLastMonthDay
}{wxdatetimesettolastmonthday
}\\
391 \helpref{GetLastMonthDay
}{wxdatetimegetlastmonthday
}\\
392 \helpref{SetToYearDay
}{wxdatetimesettoyearday
}\\
393 \helpref{GetYearDay
}{wxdatetimegetyearday
}
396 \membersection{Astronomical/historical functions
}\label{astronomyhistoryfunctions
}
398 Some degree of support for the date units used in astronomy and/or history is
399 provided. You can construct a wxDateTime object from a
400 \helpref{JDN
}{wxdatetimesetjdn
} and you may also get its JDN,
401 \helpref{MJD
}{wxdatetimegetmodifiedjuliandaynumber
} or
402 \helpref{Rata Die number
}{wxdatetimegetratadie
} from it.
404 \helpref{wxDateTime(double jdn)
}{wxdatetimewxdatetimejdn
}\\
405 \helpref{Set(double jdn)
}{wxdatetimesetjdn
}\\
406 \helpref{GetJulianDayNumber
}{wxdatetimegetjuliandaynumber
}\\
407 \helpref{GetJDN
}{wxdatetimegetjdn
}\\
408 \helpref{GetModifiedJulianDayNumber
}{wxdatetimegetmodifiedjuliandaynumber
}\\
409 \helpref{GetMJD
}{wxdatetimegetmjd
}\\
410 \helpref{GetRataDie
}{wxdatetimegetratadie
}
413 \membersection{Time zone and DST support
}\label{datetimedstzone
}
415 Please see the
\helpref{time zone overview
}{tdatetimezones
} for more
416 information about time zones. Normally, these functions should be rarely used.
418 \helpref{FromTimezone
}{wxdatetimefromtimezone
}\\
419 \helpref{ToTimezone
}{wxdatetimetotimezone
}\\
420 \helpref{MakeTimezone
}{wxdatetimemaketimezone
}\\
421 \helpref{MakeFromTimezone
}{wxdatetimemakefromtimezone
}\\
422 \helpref{ToUTC
}{wxdatetimetoutc
}\\
423 \helpref{MakeUTC
}{wxdatetimemakeutc
}\\
424 \helpref{GetBeginDST
}{wxdatetimegetbegindst
}\\
425 \helpref{GetEndDST
}{wxdatetimegetenddst
}\\
426 \helpref{IsDST
}{wxdatetimeisdst
}
428 \helponly{\insertatlevel{2}{
434 %%%%%%%%%%%%%%%%%%%%%%%%%%% static functions %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
437 \membersection{wxDateTime::ConvertYearToBC
}\label{wxdatetimeconvertyeartobc
}
439 \func{static int
}{ConvertYearToBC
}{\param{int
}{year
}}
441 Converts the year in absolute notation (i.e. a number which can be negative,
442 positive or zero) to the year in BC/AD notation. For the positive years,
443 nothing is done, but the year
0 is year
1 BC and so for other years there is a
446 This function should be used like this:
450 int y = dt.GetYear();
451 printf("The year is
%d%s", wxDateTime::ConvertYearToBC(y), y > 0 ? "AD" : "BC");
455 \membersection{wxDateTime::GetAmPmStrings
}\label{wxdatetimegetampmstrings
}
457 \func{static void
}{GetAmPmStrings
}{\param{wxString *
}{am
},
\param{wxString *
}{pm
}}
459 Returns the translations of the strings
{\tt AM
} and
{\tt PM
} used for time
460 formatting for the current locale. Either of the pointers may be
{\tt NULL
} if
461 the corresponding value is not needed.
464 \membersection{wxDateTime::GetBeginDST
}\label{wxdatetimegetbegindst
}
466 \func{static wxDateTime
}{GetBeginDST
}{\param{int
}{year = Inv
\_Year},
\param{Country
}{country = Country
\_Default}}
468 Get the beginning of DST for the given country in the given year (current one
469 by default). This function suffers from limitations described in
470 \helpref{DST overview
}{tdatedst
}.
474 \helpref{GetEndDST
}{wxdatetimegetenddst
}
477 \membersection{wxDateTime::GetCountry
}\label{wxdatetimegetcountry
}
479 \func{static Country
}{GetCountry
}{\void}
481 Returns the current default country. The default country is used for DST
482 calculations, for example.
486 \helpref{SetCountry
}{wxdatetimesetcountry
}
489 \membersection{wxDateTime::GetCurrentYear
}\label{wxdatetimegetcurrentyear
}
491 \func{static int
}{GetCurrentYear
}{\param{Calendar
}{cal = Gregorian
}}
493 Get the current year in given calendar (only Gregorian is currently supported).
496 \membersection{wxDateTime::GetCurrentMonth
}\label{wxdatetimegetcurrentmonth
}
498 \func{static Month
}{GetCurrentMonth
}{\param{Calendar
}{cal = Gregorian
}}
500 Get the current month in given calendar (only Gregorian is currently supported).
503 \membersection{wxDateTime::GetCentury
}\label{wxdatetimegetcenturystatic
}
505 \func{static int
}{GetCentury
}{\param{int
}{year
}}
507 Get the current century, i.e. first two digits of the year, in given calendar
508 (only Gregorian is currently supported).
511 \membersection{wxDateTime::GetEndDST
}\label{wxdatetimegetenddst
}
513 \func{static wxDateTime
}{GetEndDST
}{\param{int
}{year = Inv
\_Year},
\param{Country
}{country = Country
\_Default}}
515 Returns the end of DST for the given country in the given year (current one by
520 \helpref{GetBeginDST
}{wxdatetimegetbegindst
}
523 \membersection{wxDateTime::GetMonthName
}\label{wxdatetimegetmonthname
}
525 \func{static wxString
}{GetMonthName
}{\param{Month
}{month
},
\param{NameFlags
}{flags = Name
\_Full}}
527 Gets the full (default) or abbreviated (specify
{\tt Name
\_Abbr} name of the
532 \helpref{GetWeekDayName
}{wxdatetimegetweekdayname
}
535 \membersection{wxDateTime::GetNumberOfDays
}\label{wxdatetimegetnumberofdays
}
537 \func{static wxDateTime
\_t}{GetNumberOfDays
}{\param{int
}{year
},
\param{Calendar
}{cal = Gregorian
}}
539 \func{static wxDateTime
\_t}{GetNumberOfDays
}{\param{Month
}{month
},
\param{int
}{year = Inv
\_Year},
\param{Calendar
}{cal = Gregorian
}}
541 Returns the number of days in the given year or in the given month of the
544 The only supported value for
{\it cal
} parameter is currently
{\tt Gregorian
}.
546 \pythonnote{These two methods are named
{\tt GetNumberOfDaysInYear
}
547 and
{\tt GetNumberOfDaysInMonth
} in wxPython.
}
550 \membersection{wxDateTime::GetTimeNow
}\label{wxdatetimegettimenow
}
552 \func{static time
\_t}{GetTimeNow
}{\void}
554 Returns the current time.
557 \membersection{wxDateTime::GetTmNow
}\label{wxdatetimegettmnow
}
559 \func{static struct tm *
}{GetTmNow
}{\param{struct tm *
}{tm
}}
561 Returns the current time broken down, uses the buffer whose adress is
562 passed to the function via
{\it tm
} to store the result.
564 \membersection{wxDateTime::GetTmNow
}
566 \func{static struct tm *
}{GetTmNow
}{\void}
568 Returns the current time broken down. Note that this function returns a
569 pointer to a static buffer that's reused by calls to this function and
570 certain C library functions (e.g. localtime). If there is any chance your
571 code might be used in a multi-threaded application, you really should use
572 the flavour of function
\helpref{wxDateTime::GetTmNow
}{wxdatetimegettmnow
}
575 \membersection{wxDateTime::GetWeekDayName
}\label{wxdatetimegetweekdayname
}
577 \func{static wxString
}{GetWeekDayName
}{\param{WeekDay
}{weekday
},
\param{NameFlags
}{flags = Name
\_Full}}
579 Gets the full (default) or abbreviated (specify
{\tt Name
\_Abbr} name of the
584 \helpref{GetMonthName
}{wxdatetimegetmonthname
}
587 \membersection{wxDateTime::IsLeapYear
}\label{wxdatetimeisleapyear
}
589 \func{static bool
}{IsLeapYear
}{\param{int
}{year = Inv
\_Year},
\param{Calendar
}{cal = Gregorian
}}
591 Returns
{\tt true
} if the
{\it year
} is a leap one in the specified calendar.
593 This functions supports Gregorian and Julian calendars.
596 \membersection{wxDateTime::IsWestEuropeanCountry
}\label{wxdatetimeiswesteuropeancountry
}
598 \func{static bool
}{IsWestEuropeanCountry
}{\param{Country
}{country = Country
\_Default}}
600 This function returns
{\tt true
} if the specified (or default) country is one
601 of Western European ones. It is used internally by wxDateTime to determine the
602 DST convention and date and time formatting rules.
605 \membersection{wxDateTime::IsDSTApplicable
}\label{wxdatetimeisdstapplicable
}
607 \func{static bool
}{IsDSTApplicable
}{\param{int
}{year = Inv
\_Year},
\param{Country
}{country = Country
\_Default}}
609 Returns
{\tt true
} if DST was used n the given year (the current one by
610 default) in the given country.
613 \membersection{wxDateTime::Now
}\label{wxdatetimenow
}
615 \func{static wxDateTime
}{Now
}{\void}
617 Returns the object corresponding to the current time.
622 wxDateTime now = wxDateTime::Now();
623 printf("Current time in Paris:
\t%s\n", now.Format("%c", wxDateTime::CET).c_str());
626 Note that this function is accurate up to second:
627 \helpref{wxDateTime::UNow
}{wxdatetimeunow
} should be used for better precision
628 (but it is less efficient and might not be available on all platforms).
632 \helpref{Today
}{wxdatetimetoday
}
635 \membersection{wxDateTime::SetCountry
}\label{wxdatetimesetcountry
}
637 \func{static void
}{SetCountry
}{\param{Country
}{country
}}
639 Sets the country to use by default. This setting influences the DST
640 calculations, date formatting and other things.
642 The possible values for
{\it country
} parameter are enumerated in
643 \helpref{wxDateTime constants section
}{wxdatetime
}.
647 \helpref{GetCountry
}{wxdatetimegetcountry
}
650 \membersection{wxDateTime::Today
}\label{wxdatetimetoday
}
652 \func{static wxDateTime
}{Today
}{\void}
654 Returns the object corresponding to the midnight of the current day (i.e. the
655 same as
\helpref{Now()
}{wxdatetimenow
}, but the time part is set to $
0$).
659 \helpref{Now
}{wxdatetimenow
}
662 \membersection{wxDateTime::UNow
}\label{wxdatetimeunow
}
664 \func{static wxDateTime
}{UNow
}{\void}
666 Returns the object corresponding to the current time including the
667 milliseconds if a function to get time with such precision is available on the
668 current platform (supported under most Unices and Win32).
672 \helpref{Now
}{wxdatetimenow
}
674 %%%%%%%%%%%%%%%%%%%%%%%%%%% constructors &c %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
677 \membersection{wxDateTime::wxDateTime
}\label{wxdatetimewxdatetimedef
}
679 \func{}{wxDateTime
}{\void}
681 Default constructor. Use one of
{\tt Set()
} functions to initialize the object
685 \membersection{wxDateTime::wxDateTime
}\label{wxdatetimewxdatetimetimet
}
687 \func{wxDateTime\&
}{wxDateTime
}{\param{time
\_t }{timet
}}
689 Same as
\helpref{Set
}{wxdatetimewxdatetimetimet
}.
691 \pythonnote{This constructor is named
{\tt wxDateTimeFromTimeT
} in wxPython.
}
694 \membersection{wxDateTime::wxDateTime
}\label{wxdatetimewxdatetimetm
}
696 \func{wxDateTime\&
}{wxDateTime
}{\param{const struct tm\&
}{tm
}}
698 Same as
\helpref{Set
}{wxdatetimewxdatetimetm
}
700 \pythonnote{Unsupported.
}
703 \membersection{wxDateTime::wxDateTime
}\label{wxdatetimewxdatetimejdn
}
705 \func{wxDateTime\&
}{wxDateTime
}{\param{double
}{jdn
}}
707 Same as
\helpref{Set
}{wxdatetimewxdatetimejdn
}
709 \pythonnote{This constructor is named
{\tt wxDateTimeFromJDN
} in wxPython.
}
712 \membersection{wxDateTime::wxDateTime
}\label{wxdatetimewxdatetimetime
}
714 \func{wxDateTime\&
}{wxDateTime
}{\param{wxDateTime
\_t }{hour
},
\param{wxDateTime
\_t }{minute =
0},
\param{wxDateTime
\_t }{second =
0},
\param{wxDateTime
\_t }{millisec =
0}}
716 Same as
\helpref{Set
}{wxdatetimewxdatetimetime
}
718 \pythonnote{This constructor is named
{\tt wxDateTimeFromHMS
} in wxPython.
}
721 \membersection{wxDateTime::wxDateTime
}\label{wxdatetimewxdatetimedate
}
723 \func{wxDateTime\&
}{wxDateTime
}{\param{wxDateTime
\_t }{day
},
\param{Month
}{month = Inv
\_Month},
\param{int
}{ Inv
\_Year},
724 \param{wxDateTime
\_t }{hour =
0},
\param{wxDateTime
\_t }{minute =
0},
\param{wxDateTime
\_t }{second =
0},
\param{wxDateTime
\_t }{millisec =
0}}
726 Same as
\helpref{Set
}{wxdatetimesetdate
}
728 \pythonnote{This constructor is named
{\tt wxDateTimeFromDMY
} in wxPython.
}
731 \membersection{wxDateTime::SetToCurrent
}\label{wxdatetimesettocurrent
}
733 \func{wxDateTime\&
}{SetToCurrent
}{\void}
735 Sets the date and time of to the current values. Same as assigning the result
736 of
\helpref{Now()
}{wxdatetimenow
} to this object.
739 \membersection{wxDateTime::Set
}\label{wxdatetimesettimet
}
741 \func{wxDateTime\&
}{Set
}{\param{time
\_t }{timet
}}
743 Constructs the object from
{\it timet
} value holding the number of seconds
746 \pythonnote{This method is named
{\tt SetTimeT
} in wxPython.
}
749 \membersection{wxDateTime::Set
}\label{wxdatetimesettm
}
751 \func{wxDateTime\&
}{Set
}{\param{const struct tm\&
}{tm
}}
753 Sets the date and time from the broken down representation in the standard
756 \pythonnote{Unsupported.
}
759 \membersection{wxDateTime::Set
}\label{wxdatetimesetjdn
}
761 \func{wxDateTime\&
}{Set
}{\param{double
}{jdn
}}
763 Sets the date from the so-called
{\it Julian Day Number
}.
765 By definition, the Julian Day Number, usually abbreviated as JDN, of a
766 particular instant is the fractional number of days since
12 hours Universal
767 Coordinated Time (Greenwich mean noon) on January
1 of the year -
4712 in the
768 Julian proleptic calendar.
770 \pythonnote{This method is named
{\tt SetJDN
} in wxPython.
}
773 \membersection{wxDateTime::Set
}\label{wxdatetimesettime
}
775 \func{wxDateTime\&
}{Set
}{\param{wxDateTime
\_t }{hour
},
\param{wxDateTime
\_t }{minute =
0},
\param{wxDateTime
\_t }{second =
0},
\param{wxDateTime
\_t }{millisec =
0}}
777 Sets the date to be equal to
\helpref{Today
}{wxdatetimetoday
} and the time
778 from supplied parameters.
780 \pythonnote{This method is named
{\tt SetHMS
} in wxPython.
}
783 \membersection{wxDateTime::Set
}\label{wxdatetimesetdate
}
785 \func{wxDateTime\&
}{Set
}{\param{wxDateTime
\_t }{day
},
\param{Month
}{month = Inv
\_Month},
\param{int
}{year = Inv
\_Year},
\param{wxDateTime
\_t }{hour =
0},
\param{wxDateTime
\_t }{minute =
0},
\param{wxDateTime
\_t }{second =
0},
\param{wxDateTime
\_t }{millisec =
0}}
787 Sets the date and time from the parameters.
790 \membersection{wxDateTime::ResetTime
}\label{wxdatetimeresettime
}
792 \func{wxDateTime\&
}{ResetTime
}{\void}
794 Reset time to midnight (
00:
00:
00) without changing the date.
797 \membersection{wxDateTime::SetYear
}\label{wxdatetimesetyear
}
799 \func{wxDateTime\&
}{SetYear
}{\param{int
}{year
}}
801 Sets the year without changing other date components.
804 \membersection{wxDateTime::SetMonth
}\label{wxdatetimesetmonth
}
806 \func{wxDateTime\&
}{SetMonth
}{\param{Month
}{month
}}
808 Sets the month without changing other date components.
811 \membersection{wxDateTime::SetDay
}\label{wxdatetimesetday
}
813 \func{wxDateTime\&
}{SetDay
}{\param{wxDateTime
\_t }{day
}}
815 Sets the day without changing other date components.
818 \membersection{wxDateTime::SetHour
}\label{wxdatetimesethour
}
820 \func{wxDateTime\&
}{SetHour
}{\param{wxDateTime
\_t }{hour
}}
822 Sets the hour without changing other date components.
825 \membersection{wxDateTime::SetMinute
}\label{wxdatetimesetminute
}
827 \func{wxDateTime\&
}{SetMinute
}{\param{wxDateTime
\_t }{minute
}}
829 Sets the minute without changing other date components.
832 \membersection{wxDateTime::SetSecond
}\label{wxdatetimesetsecond
}
834 \func{wxDateTime\&
}{SetSecond
}{\param{wxDateTime
\_t }{second
}}
836 Sets the second without changing other date components.
839 \membersection{wxDateTime::SetMillisecond
}\label{wxdatetimesetmillisecond
}
841 \func{wxDateTime\&
}{SetMillisecond
}{\param{wxDateTime
\_t }{millisecond
}}
843 Sets the millisecond without changing other date components.
846 \membersection{wxDateTime::operator$=$
}\label{wxdatetimeoperatoreqtimet
}
848 \func{wxDateTime\&
}{operator
}{\param{time
\_t }{timet
}}
850 Same as
\helpref{Set
}{wxdatetimesettimet
}.
853 \membersection{wxDateTime::operator$=$
}\label{wxdatetimeoperatoreqtm
}
855 \func{wxDateTime\&
}{operator
}{\param{const struct tm\&
}{tm
}}
857 Same as
\helpref{Set
}{wxdatetimesettm
}.
859 %%%%%%%%%%%%%%%%%%%%%%%%%%% accessors %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
862 \membersection{wxDateTime::IsValid
}\label{wxdatetimeisvalid
}
864 \constfunc{bool
}{IsValid
}{\void}
866 Returns
{\tt true
} if the object represents a valid time moment.
869 \membersection{wxDateTime::GetDateOnly
}\label{wxdatetimegetdateonly
}
871 \constfunc{wxDateTime
}{GetDateOnly
}{\void}
873 Returns the object having the same date component as this one but time of
880 \helpref{ResetTime
}{wxdatetimeresettime
}
883 \membersection{wxDateTime::GetTm
}\label{wxdatetimegettm
}
885 \constfunc{Tm
}{GetTm
}{\param{const TimeZone\&
}{tz = Local
}}
887 Returns broken down representation of the date and time.
890 \membersection{wxDateTime::GetTicks
}\label{wxdatetimegetticks
}
892 \constfunc{time
\_t}{GetTicks
}{\void}
894 Returns the number of seconds since Jan
1,
1970. An assert failure will occur
895 if the date is not in the range covered by
{\tt time
\_t} type.
898 \membersection{wxDateTime::GetCentury
}\label{wxdatetimegetcentury
}
900 \constfunc{int
}{GetCentury
}{\param{const TimeZone\&
}{tz = Local
}}
902 Returns the century of this date.
905 \membersection{wxDateTime::GetYear
}\label{wxdatetimegetyear
}
907 \constfunc{int
}{GetYear
}{\param{const TimeZone\&
}{tz = Local
}}
909 Returns the year in the given timezone (local one by default).
912 \membersection{wxDateTime::GetMonth
}\label{wxdatetimegetmonth
}
914 \constfunc{Month
}{GetMonth
}{\param{const TimeZone\&
}{tz = Local
}}
916 Returns the month in the given timezone (local one by default).
919 \membersection{wxDateTime::GetDay
}\label{wxdatetimegetday
}
921 \constfunc{wxDateTime
\_t}{GetDay
}{\param{const TimeZone\&
}{tz = Local
}}
923 Returns the day in the given timezone (local one by default).
926 \membersection{wxDateTime::GetWeekDay
}\label{wxdatetimegetweekday
}
928 \constfunc{WeekDay
}{GetWeekDay
}{\param{const TimeZone\&
}{tz = Local
}}
930 Returns the week day in the given timezone (local one by default).
933 \membersection{wxDateTime::GetHour
}\label{wxdatetimegethour
}
935 \constfunc{wxDateTime
\_t}{GetHour
}{\param{const TimeZone\&
}{tz = Local
}}
937 Returns the hour in the given timezone (local one by default).
940 \membersection{wxDateTime::GetMinute
}\label{wxdatetimegetminute
}
942 \constfunc{wxDateTime
\_t}{GetMinute
}{\param{const TimeZone\&
}{tz = Local
}}
944 Returns the minute in the given timezone (local one by default).
947 \membersection{wxDateTime::GetSecond
}\label{wxdatetimegetsecond
}
949 \constfunc{wxDateTime
\_t}{GetSecond
}{\param{const TimeZone\&
}{tz = Local
}}
951 Returns the seconds in the given timezone (local one by default).
954 \membersection{wxDateTime::GetMillisecond
}\label{wxdatetimegetmillisecond
}
956 \constfunc{wxDateTime
\_t}{GetMillisecond
}{\param{const TimeZone\&
}{tz = Local
}}
958 Returns the milliseconds in the given timezone (local one by default).
961 \membersection{wxDateTime::GetDayOfYear
}\label{wxdatetimegetdayofyear
}
963 \constfunc{wxDateTime
\_t}{GetDayOfYear
}{\param{const TimeZone\&
}{tz = Local
}}
965 Returns the day of the year (in $
1\ldots366$ range) in the given timezone
966 (local one by default).
969 \membersection{wxDateTime::GetWeekOfYear
}\label{wxdatetimegetweekofyear
}
971 \constfunc{wxDateTime
\_t}{GetWeekOfYear
}{\param{WeekFlags
}{flags = Monday
\_First},
\param{const TimeZone\&
}{tz = Local
}}
973 Returns the number of the week of the year this date is in. The first week of
974 the year is, according to international standards, the one containing Jan
4 or,
975 equivalently, the first week which has Thursday in this year. Both of these
976 definitions are the same as saying that the first week of the year must contain
977 more than half of its days in this year. Accordingly, the week number will
978 always be in $
1\ldots53$ range ($
52$ for non-leap years).
980 The function depends on the
\helpref{week start
}{wxdatetime
} convention
981 specified by the
{\it flags
} argument but its results for
982 \texttt{Sunday
\_First} are not well-defined as the ISO definition quoted above
983 applies to the weeks starting on Monday only.
986 \membersection{wxDateTime::GetWeekOfMonth
}\label{wxdatetimegetweekofmonth
}
988 \constfunc{wxDateTime
\_t}{GetWeekOfMonth
}{\param{WeekFlags
}{flags = Monday
\_First},
\param{const TimeZone\&
}{tz = Local
}}
990 Returns the ordinal number of the week in the month (in $
1\ldots5$ range).
992 As
\helpref{GetWeekOfYear
}{wxdatetimegetweekofyear
}, this function supports
993 both conventions for the week start. See the description of these
994 \helpref{week start
}{wxdatetime
} conventions.
997 \membersection{wxDateTime::IsWorkDay
}\label{wxdatetimeisworkday
}
999 \constfunc{bool
}{IsWorkDay
}{\param{Country
}{country = Country
\_Default}}
1001 Returns
{\tt true
} is this day is not a holiday in the given country.
1004 \membersection{wxDateTime::IsGregorianDate
}\label{wxdatetimeisgregoriandate
}
1006 \constfunc{bool
}{IsGregorianDate
}{\param{GregorianAdoption
}{country = Gr
\_Standard}}
1008 Returns
{\tt true
} if the given date is later than the date of adoption of the
1009 Gregorian calendar in the given country (and hence the Gregorian calendar
1010 calculations make sense for it).
1012 %%%%%%%%%%%%%%%%%%%%%% dos date and time format %%%%%%%%%%%%%%%%%%%%%%%
1015 \membersection{wxDateTime::SetFromDOS
}\label{wxdatetimesetfromdos
}
1017 \func{wxDateTime\&
}{Set
}{\param{unsigned long
}{ddt
}}
1019 Sets the date from the date and time in
1020 \urlref{DOS
}{http://developer.novell.com/ndk/doc/smscomp/index.html?page=/ndk/doc/smscomp/sms
\_docs/data/hc2vlu5i.html
}
1024 \membersection{wxDateTime::GetAsDOS
}\label{wxdatetimegetasdos
}
1026 \constfunc{unsigned long
}{GetAsDOS
}{\void}
1028 Returns the date and time in
1029 \urlref{DOS
}{http://developer.novell.com/ndk/doc/smscomp/index.html?page=/ndk/doc/smscomp/sms
\_docs/data/hc2vlu5i.html
}
1032 %%%%%%%%%%%%%%%%%%%%%%%%%%% comparison %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1035 \membersection{wxDateTime::IsEqualTo
}\label{wxdatetimeisequalto
}
1037 \constfunc{bool
}{IsEqualTo
}{\param{const wxDateTime\&
}{datetime
}}
1039 Returns
{\tt true
} if the two dates are strictly identical.
1042 \membersection{wxDateTime::IsEarlierThan
}\label{wxdatetimeisearlierthan
}
1044 \constfunc{bool
}{IsEarlierThan
}{\param{const wxDateTime\&
}{datetime
}}
1046 Returns
{\tt true
} if this date precedes the given one.
1049 \membersection{wxDateTime::IsLaterThan
}\label{wxdatetimeislaterthan
}
1051 \constfunc{bool
}{IsLaterThan
}{\param{const wxDateTime\&
}{datetime
}}
1053 Returns
{\tt true
} if this date is later than the given one.
1056 \membersection{wxDateTime::IsStrictlyBetween
}\label{wxdatetimeisstrictlybetween
}
1058 \constfunc{bool
}{IsStrictlyBetween
}{\param{const wxDateTime\&
}{t1
},
\param{const wxDateTime\&
}{t2
}}
1060 Returns
{\tt true
} if this date lies strictly between the two others,
1062 \wxheading{See also
}
1064 \helpref{IsBetween
}{wxdatetimeisbetween
}
1067 \membersection{wxDateTime::IsBetween
}\label{wxdatetimeisbetween
}
1069 \constfunc{bool
}{IsBetween
}{\param{const wxDateTime\&
}{t1
},
\param{const wxDateTime\&
}{t2
}}
1071 Returns
{\tt true
} if
\helpref{IsStrictlyBetween
}{wxdatetimeisstrictlybetween
}
1072 is
{\tt true
} or if the date is equal to one of the limit values.
1074 \wxheading{See also
}
1076 \helpref{IsStrictlyBetween
}{wxdatetimeisstrictlybetween
}
1079 \membersection{wxDateTime::IsSameDate
}\label{wxdatetimeissamedate
}
1081 \constfunc{bool
}{IsSameDate
}{\param{const wxDateTime\&
}{dt
}}
1083 Returns
{\tt true
} if the date is the same without comparing the time parts.
1086 \membersection{wxDateTime::IsSameTime
}\label{wxdatetimeissametime
}
1088 \constfunc{bool
}{IsSameTime
}{\param{const wxDateTime\&
}{dt
}}
1090 Returns
{\tt true
} if the time is the same (although dates may differ).
1093 \membersection{wxDateTime::IsEqualUpTo
}\label{wxdatetimeisequalupto
}
1095 \constfunc{bool
}{IsEqualUpTo
}{\param{const wxDateTime\&
}{dt
},
\param{const wxTimeSpan\&
}{ts
}}
1097 Returns
{\tt true
} if the date is equal to another one up to the given time
1098 interval, i.e. if the absolute difference between the two dates is less than
1101 %%%%%%%%%%%%%%%%%%%%%%%%%%% arithmetics %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1104 \membersection{wxDateTime::Add
}\label{wxdatetimeaddts
}
1106 \constfunc{wxDateTime
}{Add
}{\param{const wxTimeSpan\&
}{diff
}}
1108 \func{wxDateTime\&
}{Add
}{\param{const wxTimeSpan\&
}{diff
}}
1110 \func{wxDateTime\&
}{operator$+=$
}{\param{const wxTimeSpan\&
}{diff
}}
1112 Adds the given time span to this object.
1114 \pythonnote{This method is named
{\tt AddTS
} in wxPython.
}
1118 \membersection{wxDateTime::Add
}\label{wxdatetimeaddds
}
1120 \constfunc{wxDateTime
}{Add
}{\param{const wxDateSpan\&
}{diff
}}
1122 \func{wxDateTime\&
}{Add
}{\param{const wxDateSpan\&
}{diff
}}
1124 \func{wxDateTime\&
}{operator$+=$
}{\param{const wxDateSpan\&
}{diff
}}
1126 Adds the given date span to this object.
1128 \pythonnote{This method is named
{\tt AddDS
} in wxPython.
}
1132 \membersection{wxDateTime::Subtract
}\label{wxdatetimesubtractts
}
1134 \constfunc{wxDateTime
}{Subtract
}{\param{const wxTimeSpan\&
}{diff
}}
1136 \func{wxDateTime\&
}{Subtract
}{\param{const wxTimeSpan\&
}{diff
}}
1138 \func{wxDateTime\&
}{operator$-=$
}{\param{const wxTimeSpan\&
}{diff
}}
1140 Subtracts the given time span from this object.
1142 \pythonnote{This method is named
{\tt SubtractTS
} in wxPython.
}
1146 \membersection{wxDateTime::Subtract
}\label{wxdatetimesubtractds
}
1148 \constfunc{wxDateTime
}{Subtract
}{\param{const wxDateSpan\&
}{diff
}}
1150 \func{wxDateTime\&
}{Subtract
}{\param{const wxDateSpan\&
}{diff
}}
1152 \func{wxDateTime\&
}{operator$-=$
}{\param{const wxDateSpan\&
}{diff
}}
1154 Subtracts the given date span from this object.
1156 \pythonnote{This method is named
{\tt SubtractDS
} in wxPython.
}
1160 \membersection{wxDateTime::Subtract
}\label{wxdatetimesubtractdt
}
1162 \constfunc{wxTimeSpan
}{Subtract
}{\param{const wxDateTime\&
}{dt
}}
1164 Subtracts another date from this one and returns the difference between them
1167 %%%%%%%%%%%%%%%%%%%%%%%%%%% parsing/formatting %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1170 \membersection{wxDateTime::ParseRfc822Date
}\label{wxdatetimeparserfc822date
}
1172 \func{const wxChar *
}{ParseRfc822Date
}{\param{const wxChar*
}{date
}}
1174 Parses the string
{\it date
} looking for a date formatted according to the RFC
1175 822 in it. The exact description of this format may, of course, be found in
1176 the RFC (section $
5$), but, briefly, this is the format used in the headers of
1177 Internet email messages and one of the most common strings expressing date in
1178 this format may be something like
{\tt "Sat,
18 Dec
1999 00:
48:
30 +
0100"
}.
1180 Returns
{\tt NULL
} if the conversion failed, otherwise return the pointer to
1181 the character immediately following the part of the string which could be
1182 parsed. If the entire string contains only the date in RFC
822 format,
1183 the returned pointer will be pointing to a
{\tt NUL
} character.
1185 This function is intentionally strict, it will return an error for any string
1186 which is not RFC
822 compliant. If you need to parse date formatted in more
1187 free ways, you should use
\helpref{ParseDateTime
}{wxdatetimeparsedatetime
} or
1188 \helpref{ParseDate
}{wxdatetimeparsedate
} instead.
1191 \membersection{wxDateTime::ParseFormat
}\label{wxdatetimeparseformat
}
1193 \func{const wxChar *
}{ParseFormat
}{\param{const wxChar *
}{date
},
\param{const wxChar *
}{format = wxDefaultDateTimeFormat
},
\param{const wxDateTime\&
}{dateDef = wxDefaultDateTime
}}
1195 This function parses the string
{\it date
} according to the given
1196 {\it format
}. The system
{\tt strptime(
3)
} function is used whenever available,
1197 but even if it is not, this function is still implemented, although support
1198 for locale-dependent format specifiers such as
{\tt "\%c"
},
{\tt "\%x"
} or
{\tt "\%X"
} may
1199 not be perfect and GNU extensions such as
{\tt "\%z"
} and
{\tt "\%Z"
} are
1200 not implemented. This function does handle the month and weekday
1201 names in the current locale on all platforms, however.
1203 Please see the description of the ANSI C function
{\tt strftime(
3)
} for the syntax
1204 of the format string.
1206 The
{\it dateDef
} parameter is used to fill in the fields which could not be
1207 determined from the format string. For example, if the format is
{\tt "\%d"
} (the
1208 ay of the month), the month and the year are taken from
{\it dateDef
}. If
1209 it is not specified,
\helpref{Today
}{wxdatetimetoday
} is used as the
1212 Returns
{\tt NULL
} if the conversion failed, otherwise return the pointer to
1213 the character which stopped the scan.
1216 \membersection{wxDateTime::ParseDateTime
}\label{wxdatetimeparsedatetime
}
1218 \func{const wxChar *
}{ParseDateTime
}{\param{const wxChar *
}{datetime
}}
1220 Parses the string
{\it datetime
} containing the date and time in free format.
1221 This function tries as hard as it can to interpret the given string as date
1222 and time. Unlike
\helpref{ParseRfc822Date
}{wxdatetimeparserfc822date
}, it
1223 will accept anything that may be accepted and will only reject strings which
1224 can not be parsed in any way at all.
1226 Returns
{\tt NULL
} if the conversion failed, otherwise return the pointer to
1227 the character which stopped the scan.
1230 \membersection{wxDateTime::ParseDate
}\label{wxdatetimeparsedate
}
1232 \func{const wxChar *
}{ParseDate
}{\param{const wxChar *
}{date
}}
1234 This function is like
\helpref{ParseDateTime
}{wxdatetimeparsedatetime
}, but it
1235 only allows the date to be specified. It is thus less flexible then
1236 \helpref{ParseDateTime
}{wxdatetimeparsedatetime
}, but also has less chances to
1237 misinterpret the user input.
1239 Returns
{\tt NULL
} if the conversion failed, otherwise return the pointer to
1240 the character which stopped the scan.
1243 \membersection{wxDateTime::ParseTime
}\label{wxdatetimeparsetime
}
1245 \func{const wxChar *
}{ParseTime
}{\param{const wxChar *
}{time
}}
1247 This functions is like
\helpref{ParseDateTime
}{wxdatetimeparsedatetime
}, but
1248 only allows the time to be specified in the input string.
1250 Returns
{\tt NULL
} if the conversion failed, otherwise return the pointer to
1251 the character which stopped the scan.
1254 \membersection{wxDateTime::Format
}\label{wxdatetimeformat
}
1256 \constfunc{wxString
}{Format
}{\param{const wxChar *
}{format = wxDefaultDateTimeFormat
},
\param{const TimeZone\&
}{tz = Local
}}
1258 This function does the same as the standard ANSI C
{\tt strftime(
3)
} function.
1259 Please see its description for the meaning of
{\it format
} parameter.
1261 It also accepts a few wxWidgets-specific extensions: you can optionally specify
1262 the width of the field to follow using
{\tt printf(
3)
}-like syntax and the
1263 format specification
{\tt \%l
} can be used to get the number of milliseconds.
1265 \wxheading{See also
}
1267 \helpref{ParseFormat
}{wxdatetimeparseformat
}
1270 \membersection{wxDateTime::FormatDate
}\label{wxdatetimeformatdate
}
1272 \constfunc{wxString
}{FormatDate
}{\void}
1274 Identical to calling
\helpref{Format()
}{wxdatetimeformat
} with
{\tt "\%x"
}
1275 argument (which means `preferred date representation for the current locale').
1278 \membersection{wxDateTime::FormatTime
}\label{wxdatetimeformattime
}
1280 \constfunc{wxString
}{FormatTime
}{\void}
1282 Identical to calling
\helpref{Format()
}{wxdatetimeformat
} with
{\tt "\%X"
}
1283 argument (which means `preferred time representation for the current locale').
1286 \membersection{wxDateTime::FormatISODate
}\label{wxdatetimeformatisodate
}
1288 \constfunc{wxString
}{FormatISODate
}{\void}
1290 This function returns the date representation in the ISO
8601 format
1294 \membersection{wxDateTime::FormatISOTime
}\label{wxdatetimeformatisotime
}
1296 \constfunc{wxString
}{FormatISOTime
}{\void}
1298 This function returns the time representation in the ISO
8601 format
1301 %%%%%%%%%%%%%%%%%%%%%%%%%%% calendar calculations %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1304 \membersection{wxDateTime::SetToWeekDayInSameWeek
}\label{wxdatetimesettoweekdayinsameweek
}
1306 \func{wxDateTime\&
}{SetToWeekDayInSameWeek
}{\param{WeekDay
}{weekday
},
\param{WeekFlags
}{flags =
{\tt Monday
\_First}}}
1308 Adjusts the date so that it will still lie in the same week as before, but its
1309 week day will be the given one.
1311 Returns the reference to the modified object itself.
1314 \membersection{wxDateTime::GetWeekDayInSameWeek
}\label{wxdatetimegetweekdayinsameweek
}
1316 \constfunc{wxDateTime
}{GetWeekDayInSameWeek
}{\param{WeekDay
}{weekday
},
\param{WeekFlags
}{flags =
{\tt Monday
\_First}}}
1318 Returns the copy of this object to which
1319 \helpref{SetToWeekDayInSameWeek
}{wxdatetimesettoweekdayinsameweek
} was
1323 \membersection{wxDateTime::SetToNextWeekDay
}\label{wxdatetimesettonextweekday
}
1325 \func{wxDateTime\&
}{SetToNextWeekDay
}{\param{WeekDay
}{weekday
}}
1327 Sets the date so that it will be the first
{\it weekday
} following the current
1330 Returns the reference to the modified object itself.
1333 \membersection{wxDateTime::GetNextWeekDay
}\label{wxdatetimegetnextweekday
}
1335 \constfunc{wxDateTime
}{GetNextWeekDay
}{\param{WeekDay
}{weekday
}}
1337 Returns the copy of this object to which
1338 \helpref{SetToNextWeekDay
}{wxdatetimesettonextweekday
} was applied.
1341 \membersection{wxDateTime::SetToPrevWeekDay
}\label{wxdatetimesettoprevweekday
}
1343 \func{wxDateTime\&
}{SetToPrevWeekDay
}{\param{WeekDay
}{weekday
}}
1345 Sets the date so that it will be the last
{\it weekday
} before the current
1348 Returns the reference to the modified object itself.
1351 \membersection{wxDateTime::GetPrevWeekDay
}\label{wxdatetimegetprevweekday
}
1353 \constfunc{wxDateTime
}{GetPrevWeekDay
}{\param{WeekDay
}{weekday
}}
1355 Returns the copy of this object to which
1356 \helpref{SetToPrevWeekDay
}{wxdatetimesettoprevweekday
} was applied.
1359 \membersection{wxDateTime::SetToWeekDay
}\label{wxdatetimesettoweekday
}
1361 \func{bool
}{SetToWeekDay
}{\param{WeekDay
}{weekday
},
\param{int
}{n =
1},
\param{Month
}{month = Inv
\_Month},
\param{int
}{year = Inv
\_Year}}
1363 Sets the date to the
{\it n
}-th
{\it weekday
} in the given month of the given
1364 year (the current month and year are used by default). The parameter
{\it n
}
1365 may be either positive (counting from the beginning of the month) or negative
1366 (counting from the end of it).
1368 For example,
{\tt SetToWeekDay(
2, wxDateTime::Wed)
} will set the date to the
1369 second Wednesday in the current month and
1370 {\tt SetToWeekDay(-
1, wxDateTime::Sun)
} -- to the last Sunday in it.
1372 Returns
{\tt true
} if the date was modified successfully,
{\tt false
}
1373 otherwise meaning that the specified date doesn't exist.
1376 \membersection{wxDateTime::GetWeekDay
}\label{wxdatetimegetweekday2
}
1378 \constfunc{wxDateTime
}{GetWeekDay
}{\param{WeekDay
}{weekday
},
\param{int
}{n =
1},
\param{Month
}{month = Inv
\_Month},
\param{int
}{year = Inv
\_Year}}
1380 Returns the copy of this object to which
1381 \helpref{SetToWeekDay
}{wxdatetimesettoweekday
} was applied.
1384 \membersection{wxDateTime::SetToLastWeekDay
}\label{wxdatetimesettolastweekday
}
1386 \func{bool
}{SetToLastWeekDay
}{\param{WeekDay
}{weekday
},
\param{Month
}{month = Inv
\_Month},
\param{int
}{year = Inv
\_Year}}
1388 The effect of calling this function is the same as of calling
1389 {\tt SetToWeekDay(-
1, weekday, month, year)
}. The date will be set to the last
1390 {\it weekday
} in the given month and year (the current ones by default).
1392 Always returns
{\tt true
}.
1395 \membersection{wxDateTime::GetLastWeekDay
}\label{wxdatetimegetlastweekday
}
1397 \func{wxDateTime
}{GetLastWeekDay
}{\param{WeekDay
}{weekday
},
\param{Month
}{month = Inv
\_Month},
\param{int
}{year = Inv
\_Year}}
1399 Returns the copy of this object to which
1400 \helpref{SetToLastWeekDay
}{wxdatetimesettolastweekday
} was applied.
1403 \membersection{wxDateTime::SetToWeekOfYear
}\label{wxdatetimesettoweekofyear
}
1405 \func{static wxDateTime
}{SetToWeekOfYear
}{\param{int
}{year
},
\param{wxDateTime
\_t }{numWeek
},
\param{WeekDay
}{weekday = Mon
}}
1407 Set the date to the given
\arg{weekday
} in the week number
\arg{numWeek
} of the
1408 given
\arg{year
} . The number should be in range $
1\ldots53$.
1410 Note that the returned date may be in a different year than the one passed to
1411 this function because both the week $
1$ and week $
52$ or $
53$ (for leap years)
1412 contain days from different years. See
1413 \helpref{GetWeekOfYear
}{wxdatetimegetweekofyear
} for the explanation of how the
1414 year weeks are counted.
1417 \membersection{wxDateTime::SetToLastMonthDay
}\label{wxdatetimesettolastmonthday
}
1419 \func{wxDateTime\&
}{SetToLastMonthDay
}{\param{Month
}{month = Inv
\_Month},
\param{int
}{year = Inv
\_Year}}
1421 Sets the date to the last day in the specified month (the current one by
1424 Returns the reference to the modified object itself.
1427 \membersection{wxDateTime::GetLastMonthDay
}\label{wxdatetimegetlastmonthday
}
1429 \constfunc{wxDateTime
}{GetLastMonthDay
}{\param{Month
}{month = Inv
\_Month},
\param{int
}{year = Inv
\_Year}}
1431 Returns the copy of this object to which
1432 \helpref{SetToLastMonthDay
}{wxdatetimesettolastmonthday
} was applied.
1435 \membersection{wxDateTime::SetToYearDay
}\label{wxdatetimesettoyearday
}
1437 \func{wxDateTime\&
}{SetToYearDay
}{\param{wxDateTime
\_t }{yday
}}
1439 Sets the date to the day number
{\it yday
} in the same year (i.e., unlike the
1440 other functions, this one does not use the current year). The day number
1441 should be in the range $
1\ldots366$ for the leap years and $
1\ldots365$ for
1444 Returns the reference to the modified object itself.
1447 \membersection{wxDateTime::GetYearDay
}\label{wxdatetimegetyearday
}
1449 \constfunc{wxDateTime
}{GetYearDay
}{\param{wxDateTime
\_t }{yday
}}
1451 Returns the copy of this object to which
1452 \helpref{SetToYearDay
}{wxdatetimesettoyearday
} was applied.
1454 %%%%%%%%%%%%%%%%%%%%%%%%%%% astronomical functions %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1457 \membersection{wxDateTime::GetJulianDayNumber
}\label{wxdatetimegetjuliandaynumber
}
1459 \constfunc{double
}{GetJulianDayNumber
}{\void}
1461 Returns the
\helpref{JDN
}{wxdatetimesetjdn
} corresponding to this date. Beware
1464 \wxheading{See also
}
1466 \helpref{GetModifiedJulianDayNumber
}{wxdatetimegetmodifiedjuliandaynumber
}
1469 \membersection{wxDateTime::GetJDN
}\label{wxdatetimegetjdn
}
1471 \constfunc{double
}{GetJDN
}{\void}
1473 Synonym for
\helpref{GetJulianDayNumber
}{wxdatetimegetjuliandaynumber
}.
1476 \membersection{wxDateTime::GetModifiedJulianDayNumber
}\label{wxdatetimegetmodifiedjuliandaynumber
}
1478 \constfunc{double
}{GetModifiedJulianDayNumber
}{\void}
1480 Returns the
{\it Modified Julian Day Number
} (MJD) which is, by definition,
1481 equal to $JDN -
2400000.5$. The MJDs are simpler to work with as the integral
1482 MJDs correspond to midnights of the dates in the Gregorian calendar and not th
1483 noons like JDN. The MJD $
0$ is Nov
17,
1858.
1486 \membersection{wxDateTime::GetMJD
}\label{wxdatetimegetmjd
}
1488 \constfunc{double
}{GetMJD
}{\void}
1490 Synonym for
\helpref{GetModifiedJulianDayNumber
}{wxdatetimegetmodifiedjuliandaynumber
}.
1493 \membersection{wxDateTime::GetRataDie
}\label{wxdatetimegetratadie
}
1495 \constfunc{double
}{GetRataDie
}{\void}
1497 Return the
{\it Rata Die number
} of this date.
1499 By definition, the Rata Die number is a date specified as the number of days
1500 relative to a base date of December
31 of the year
0. Thus January
1 of the
1501 year
1 is Rata Die day
1.
1503 %%%%%%%%%%%%%%%%%%%%%%%%%%% timezone and DST %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1506 \membersection{wxDateTime::FromTimezone
}\label{wxdatetimefromtimezone
}
1508 \constfunc{wxDateTime
}{FromTimezone
}{\param{const TimeZone\&
}{tz
},
\param{bool
}{noDST = false
}}
1510 Transform the date from the given time zone to the local one. If
{\it noDST
} is
1511 {\tt true
}, no DST adjustments will be made.
1513 Returns the date in the local time zone.
1516 \membersection{wxDateTime::ToTimezone
}\label{wxdatetimetotimezone
}
1518 \constfunc{wxDateTime
}{ToTimezone
}{\param{const TimeZone\&
}{tz
},
\param{bool
}{noDST = false
}}
1520 Transform the date to the given time zone. If
{\it noDST
} is
{\tt true
}, no
1521 DST adjustments will be made.
1523 Returns the date in the new time zone.
1526 \membersection{wxDateTime::MakeTimezone
}\label{wxdatetimemaketimezone
}
1528 \func{wxDateTime\&
}{MakeTimezone
}{\param{const TimeZone\&
}{tz
},
\param{bool
}{noDST = false
}}
1530 Modifies the object in place to represent the date in another time zone. If
1531 {\it noDST
} is
{\tt true
}, no DST adjustments will be made.
1534 \membersection{wxDateTime::MakeFromTimezone
}\label{wxdatetimemakefromtimezone
}
1536 \func{wxDateTime\&
}{MakeFromTimezone
}{\param{const TimeZone\&
}{tz
},
\param{bool
}{noDST = false
}}
1538 Same as
\helpref{FromTimezone
}{wxdatetimefromtimezone
} but modifies the object
1542 \membersection{wxDateTime::ToUTC
}\label{wxdatetimetoutc
}
1544 \constfunc{wxDateTime
}{ToUTC
}{\param{bool
}{noDST = false
}}
1546 This is the same as calling
\helpref{ToTimezone
}{wxdatetimetotimezone
} with
1547 the argument
{\tt GMT0
}.
1550 \membersection{wxDateTime::MakeUTC
}\label{wxdatetimemakeutc
}
1552 \func{wxDateTime\&
}{MakeUTC
}{\param{bool
}{noDST = false
}}
1554 This is the same as calling
\helpref{MakeTimezone
}{wxdatetimemaketimezone
} with
1555 the argument
{\tt GMT0
}.
1558 \membersection{wxDateTime::IsDST
}\label{wxdatetimeisdst
}
1560 \constfunc{int
}{IsDST
}{\param{Country
}{country = Country
\_Default}}
1562 Returns
{\tt true
} if the DST is applied for this date in the given country.
1564 \wxheading{See also
}
1566 \helpref{GetBeginDST
}{wxdatetimegetbegindst
} and
1567 \helpref{GetEndDST
}{wxdatetimegetenddst
}
1569 \section{\class{wxDateTimeHolidayAuthority
}}\label{wxdatetimeholidayauthority
}
1571 \wxheading{Derived from
}
1575 \wxheading{Include files
}
1581 \helpref{wxBase
}{librarieslist
}
1583 \latexignore{\rtfignore{\wxheading{Members
}}}
1587 \section{\class{wxDateTimeWorkDays
}}\label{wxdatetimeworkdays
}
1589 \wxheading{Derived from
}
1593 \wxheading{Include files
}
1599 \helpref{wxBase
}{librarieslist
}
1601 \latexignore{\rtfignore{\wxheading{Members
}}}