*********** wx.DateTime *********** Inheritance diagram for `wx.DateTime`: | .. inheritance-diagram:: wx.DateTime | Description =========== `wx.DateTime` class represents an absolute moment in the time. Methods Summary ^^^^^^^^^^^^^^^ * `__init__ <#__init__>`_ * `AddDS <#AddDS>`_ * `AddTS <#AddTS>`_ * `ConvertYearToBC <#ConvertYearToBC>`_ * `Format <#Format>`_ * `FormatDate <#FormatDate>`_ * `FormatISODate <#FormatISODate>`_ * `FormatISOTime <#FormatISOTime>`_ * `FormatTime <#FormatTime>`_ * `FromTimezone <#FromTimezone>`_ * `FromUTC <#FromUTC>`_ * `GetAmPmStrings <#GetAmPmStrings>`_ * `GetBeginDST <#GetBeginDST>`_ * `GetCentury <#GetCentury>`_ * `GetCountry <#GetCountry>`_ * `GetCurrentMonth <#GetCurrentMonth>`_ * `GetCurrentYear <#GetCurrentYear>`_ * `GetDateOnly <#GetDateOnly>`_ * `GetDay <#GetDay>`_ * `GetDayOfYear <#GetDayOfYear>`_ * `GetEndDST <#GetEndDST>`_ * `GetHour <#GetHour>`_ * `GetJDN <#GetJDN>`_ * `GetJulianDayNumber <#GetJulianDayNumber>`_ * `GetLastMonthDay <#GetLastMonthDay>`_ * `GetLastWeekDay <#GetLastWeekDay>`_ * `GetMJD <#GetMJD>`_ * `GetMillisecond <#GetMillisecond>`_ * `GetMinute <#GetMinute>`_ * `GetModifiedJulianDayNumber <#GetModifiedJulianDayNumber>`_ * `GetMonth <#GetMonth>`_ * `GetMonthName <#GetMonthName>`_ * `GetNextWeekDay <#GetNextWeekDay>`_ * `GetNumberOfDaysInMonth <#GetNumberOfDaysInMonth>`_ * `GetNumberOfDaysInYear <#GetNumberOfDaysInYear>`_ * `GetPrevWeekDay <#GetPrevWeekDay>`_ * `GetRataDie <#GetRataDie>`_ * `GetSecond <#GetSecond>`_ * `GetTicks <#GetTicks>`_ * `GetWeekDay <#GetWeekDay>`_ * `GetWeekDayInSameWeek <#GetWeekDayInSameWeek>`_ * `GetWeekDayName <#GetWeekDayName>`_ * `GetWeekOfMonth <#GetWeekOfMonth>`_ * `GetWeekOfYear <#GetWeekOfYear>`_ * `GetYear <#GetYear>`_ * `GetYearDay <#GetYearDay>`_ * `IsBetween <#IsBetween>`_ * `IsDST <#IsDST>`_ * `IsDSTApplicable <#IsDSTApplicable>`_ * `IsEarlierThan <#IsEarlierThan>`_ * `IsEqualTo <#IsEqualTo>`_ * `IsEqualUpTo <#IsEqualUpTo>`_ * `IsLaterThan <#IsLaterThan>`_ * `IsLeapYear <#IsLeapYear>`_ * `IsSameDate <#IsSameDate>`_ * `IsSameTime <#IsSameTime>`_ * `IsStrictlyBetween <#IsStrictlyBetween>`_ * `IsValid <#IsValid>`_ * `IsWestEuropeanCountry <#IsWestEuropeanCountry>`_ * `IsWorkDay <#IsWorkDay>`_ * `MakeFromTimezone <#MakeFromTimezone>`_ * `MakeFromUTC <#MakeFromUTC>`_ * `MakeGMT <#MakeGMT>`_ * `MakeTimezone <#MakeTimezone>`_ * `MakeUTC <#MakeUTC>`_ * `Now <#Now>`_ * `ParseDate <#ParseDate>`_ * `ParseDateTime <#ParseDateTime>`_ * `ParseFormat <#ParseFormat>`_ * `ParseRfc822Date <#ParseRfc822Date>`_ * `ParseTime <#ParseTime>`_ * `ResetTime <#ResetTime>`_ * `Set <#Set>`_ * `SetCountry <#SetCountry>`_ * `SetDay <#SetDay>`_ * `SetHMS <#SetHMS>`_ * `SetHour <#SetHour>`_ * `SetJDN <#SetJDN>`_ * `SetMillisecond <#SetMillisecond>`_ * `SetMinute <#SetMinute>`_ * `SetMonth <#SetMonth>`_ * `SetSecond <#SetSecond>`_ * `SetTimeT <#SetTimeT>`_ * `SetToCurrent <#SetToCurrent>`_ * `SetToLastMonthDay <#SetToLastMonthDay>`_ * `SetToLastWeekDay <#SetToLastWeekDay>`_ * `SetToNextWeekDay <#SetToNextWeekDay>`_ * `SetToPrevWeekDay <#SetToPrevWeekDay>`_ * `SetToWeekDay <#SetToWeekDay>`_ * `SetToWeekDayInSameWeek <#SetToWeekDayInSameWeek>`_ * `SetToWeekOfYear <#SetToWeekOfYear>`_ * `SetToYearDay <#SetToYearDay>`_ * `SetYear <#SetYear>`_ * `Subtract <#Subtract>`_ * `SubtractDS <#SubtractDS>`_ * `SubtractTS <#SubtractTS>`_ * `ToGMT <#ToGMT>`_ * `ToTimezone <#ToTimezone>`_ * `ToUTC <#ToUTC>`_ * `Today <#Today>`_ * `UNow <#UNow>`_ Properties Summary ^^^^^^^^^^^^^^^^^^ * `Day <#Day>`_ * `DayOfYear <#DayOfYear>`_ * `Hour <#Hour>`_ * `JDN <#JDN>`_ * `JulianDayNumber <#JulianDayNumber>`_ * `LastMonthDay <#LastMonthDay>`_ * `LastWeekDay <#LastWeekDay>`_ * `MJD <#MJD>`_ * `Millisecond <#Millisecond>`_ * `Minute <#Minute>`_ * `ModifiedJulianDayNumber <#ModifiedJulianDayNumber>`_ * `Month <#Month>`_ * `NextWeekDay <#NextWeekDay>`_ * `PrevWeekDay <#PrevWeekDay>`_ * `RataDie <#RataDie>`_ * `Second <#Second>`_ * `Ticks <#Ticks>`_ * `Week <#Week>`_ * `WeekDay <#WeekDay>`_ * `WeekDayInSameWeek <#WeekDayInSameWeek>`_ * `WeekOfMonth <#WeekOfMonth>`_ * `WeekOfYear <#WeekOfYear>`_ * `Year <#Year>`_ * `YearDay <#YearDay>`_ Class API ========= Methods ^^^^^^^ .. method:: __init__() `No docstrings available for this method.` -------- .. method:: AddDS(diff) Adds the `wx.DateSpan `_ `diff` to self. **Parameters:** * `diff` (`wx.DateSpan `_) | **Returns:** `wx.DateTime `_ -------- .. method:: AddTS(diff) Adds the `wx.TimeSpan `_ `diff` to self. **Parameters:** * `diff` (`wx.TimeSpan `_) | **Returns:** `wx.DateTime `_ -------- .. method:: ConvertYearToBC(year) Converts the year in absolute notation (i.e. a number which can be negative, positive or zero) to the year in BC/AD notation. For the positive years, nothing is done, but the year 0 is year 1 BC and so for other years there is a difference of 1. **Parameters:** * `year` (int) | **Returns:** `int` -------- .. method:: Format(format=wx.DefaultDateTimeFormat, tz=wx.DateTime.Local) This function does the same as the standard ANSI C ``strftime(3)`` function. Please see its description for the meaning of `format` parameter. **Parameters:** * `format` (string) * `tz` (int) | **Returns:** `string` .. seealso:: `ParseFormat <#ParseFormat>`_ -------- .. method:: FormatDate() Identical to calling `Format <#Format>`_ with ``"%x"`` argument (which means 'preferred date representation for the current locale'). | **Returns:** `string` -------- .. method:: FormatISODate() This function returns the date representation in the ISO 8601 format (YYYY-MM-DD). | **Returns:** `string` -------- .. method:: FormatISOTime() This function returns the time representation in the ISO 8601 format (HH:MM:SS). | **Returns:** `string` -------- .. method:: FormatTime() Identical to calling `Format <#Format>`_ with ``"%X"`` argument (which means 'preferred time representation for the current locale'). | **Returns:** `string` -------- .. method:: FromTimezone(tz, noDST=False) Transform the date from the given time zone to the local one. If `noDST` is ``True``, no DST adjustments will be made. Returns the date in the local time zone. **Parameters:** * `tz` (int) * `noDST` (bool) | **Returns:** `wx.DateTime `_ -------- .. method:: FromUTC(noDST=False) | **Parameters:** * `noDST` (bool) | **Returns:** `wx.DateTime `_ -------- .. method:: GetAmPmStrings() Returns the translations of the strings ``AM`` and ``PM`` used for time formatting for the current locale. Either of the pointers may be ``None`` if the corresponding value is not needed. | **Returns:** `(am, pm)` -------- .. method:: GetBeginDST(year=wx.DateTime.Inv_Year, country=wx.DateTime.Country_Default) Get the beginning of DST for the given country in the given year (current one by default). **Parameters:** * `year` (int) * `country` (int) | **Returns:** `wx.DateTime `_ .. seealso:: `GetEndDST <#GetEndDST>`_ -------- .. method:: GetCentury(tz=wx.DateTime.Local) Returns the century of this date. **Parameters:** * `tz` (int) | **Returns:** `int` -------- .. method:: GetCountry() Returns the current default country. The default country is used for DST calculations, for example. | **Returns:** `int` .. seealso:: `SetCountry <#SetCountry>`_ -------- .. method:: GetCurrentMonth(cal=wx.DateTime.Gregorian) Get the current month in given calendar (only Gregorian is currently supported). **Parameters:** * `cal` (int) | **Returns:** `int` -------- .. method:: GetCurrentYear(cal=wx.DateTime.Gregorian) Get the current year in given calendar (only Gregorian is currently supported). **Parameters:** * `cal` (int) | **Returns:** `int` -------- .. method:: GetDateOnly() Returns the object having the same date component as this one but time of 00:00:00. This function is new since wxWidgets version 2.8.2 | **Returns:** `wx.DateTime `_ .. seealso:: `ResetTime <#ResetTime>`_ -------- .. method:: GetDay() Returns the day in the given timezone (local one by default). | **Returns:** `int` -------- .. method:: GetDayOfYear() Returns the day of the year (in 1...366 range) in the given timezone (local one by default). | **Returns:** `int` -------- .. method:: GetEndDST(year=wx.DateTime.Inv_Year, country=wx.DateTime.Country_Default) Returns the end of DST for the given country in the given year (current one by default). **Parameters:** * `year` (int) * `country` (int) | **Returns:** `wx.DateTime `_ .. seealso:: `GetBeginDST <#GetBeginDST>`_ -------- .. method:: GetHour() Returns the hour in the given timezone (local one by default). | **Returns:** `int` -------- .. method:: GetJDN() Synonym for `GetJulianDayNumber <#GetJulianDayNumber>`_. | **Returns:** `double` -------- .. method:: GetJulianDayNumber() Returns the `JDN <#JDN>`_ corresponding to this date. | **Returns:** `double` .. warning:: Beware of rounding errors! .. seealso:: `GetModifiedJulianDayNumber <#GetModifiedJulianDayNumber>`_ -------- .. method:: GetLastMonthDay(month=wx.DateTime.Inv_Month, year=wx.DateTime.Inv_Year) Returns the copy of this object to which `SetToLastMonthDay <#SetToLastMonthDay>`_ was applied. **Parameters:** * `month` (int) * `year` (int) | **Returns:** `wx.DateTime `_ -------- .. method:: GetLastWeekDay(weekday, month=wx.DateTime.Inv_Month, year=wx.DateTime.Inv_Year) Returns the copy of this object to which `SetToLastWeekDay <#SetToLastWeekDay>`_ was applied. **Parameters:** * `weekday` (int) * `month` (int) * `year` (int) | **Returns:** `wx.DateTime `_ -------- .. method:: GetMJD() Synonym for `GetModifiedJulianDayNumber <#GetModifiedJulianDayNumber>`_. | **Returns:** `double` -------- .. method:: GetMillisecond() Returns the milliseconds in the given timezone (local one by default). | **Returns:** `int` -------- .. method:: GetMinute() Returns the minute in the given timezone (local one by default). | **Returns:** `int` -------- .. method:: GetModifiedJulianDayNumber() Returns the *Modified Julian Day Number* (MJD) which is, by definition, equal to JDN - 2400000.5. The MJDs are simpler to work with as the integral MJDs correspond to midnights of the dates in the Gregorian calendar and not th noons like JDN. The MJD 0 is Nov 17, 1858. | **Returns:** `double` -------- .. method:: GetMonth() Returns the month in the given timezone (local one by default). | **Returns:** `int` -------- .. method:: GetMonthName(month, flag=wx.DateTime.Name_Full) Gets the full (default) or abbreviated (specify ``wx.DateTime.Name_Abbr`` name of the given month. **Parameters:** * `month` (int) * `flag` (int) | **Returns:** `string` .. seealso:: `GetWeekDayName <#GetWeekDayName>`_ -------- .. method:: GetNextWeekDay(weekday) Returns the copy of this object to which `SetToNextWeekDay <#SetToNextWeekDay>`_ was applied. **Parameters:** * `weekday` (int) | **Returns:** `wx.DateTime `_ -------- .. method:: GetNumberOfDaysInMonth(month, year=wx.DateTime.Inv_Year, cal=wx.DateTime.Gregorian) Returns the number of days in the given month of the given year, using the specified calendar. **Parameters:** * `month` (int) * `year` (int) * `cal` (int) | **Returns:** `int` -------- .. method:: GetNumberOfDaysInYear(year, cal=wx.DateTime.Gregorian) Returns the number of days in the given year, using the specified calendar. **Parameters:** * `year` (int) * `cal` (int) | **Returns:** `int` -------- .. method:: GetPrevWeekDay(weekday) Returns the copy of this object to which `SetToPrevWeekDay <#SetToPrevWeekDay>`_ was applied. **Parameters:** * `weekday` (int) | **Returns:** `wx.DateTime `_ -------- .. method:: GetRataDie() Return the *Rata Die number* of this date. By definition, the Rata Die number is a date specified as the number of days relative to a base date of December 31 of the year 0. Thus January 1 of the year 1 is Rata Die day 1. | **Returns:** `double` -------- .. method:: GetSecond() Returns the seconds in the given timezone (local one by default). | **Returns:** `int` -------- .. method:: GetTicks() Returns the number of seconds since Jan 1, 1970. An assert failure will occur if the date is not in the range covered by ``time_t`` type. | **Returns:** `time_t` -------- .. method:: GetWeekDay(weekday) Returns the copy of this object to which `SetToWeekDay <#SetToWeekDay>`_ was applied. **Parameters:** * `weekday` (int) | **Returns:** `wx.DateTime `_ -------- .. method:: GetWeekDayInSameWeek(weekday, flags=wx.DateTime.Monday_First) Returns the copy of this object to which `SetToWeekDayInSameWeek <#SetToWeekDayInSameWeek>`_ was applied. **Parameters:** * `weekday` (int) * `flag` (int) | **Returns:** `wx.DateTime `_ -------- .. method:: GetWeekDayName(weekday, flag=wx.DateTime.Name_Full) Gets the full (default) or abbreviated (specify ``wx.DateTime.Name_Abbr`` name of the given week day. **Parameters:** * `weekday` (int) * `flag` (int) | **Returns:** `string` .. seealso:: `GetMonthName <#GetMonthName>`_ -------- .. method:: GetWeekOfMonth(flags=wx.DateTime.Monday_First, tz=wx.DateTime.Local) Returns the ordinal number of the week in the month (in 1...5 range). As `GetWeekOfYear <#GetWeekOfYear>`_, this function supports both conventions for the week start. **Parameters:** * `flags` (int) * `tz` (int) | **Returns:** `int` -------- .. method:: GetWeekOfYear(flags=wx.DateTime.Monday_First, tz=wx.DateTime.Local) Returns the number of the week of the year this date is in. The first week of the year is, according to international standards, the one containing Jan 4 or, equivalently, the first week which has Thursday in this year. Both of these definitions are the same as saying that the first week of the year must contain more than half of its days in this year. Accordingly, the week number will always be in 1...53 range (52 for non-leap years). The function depends on the convention specified by the `flags` argument but its results for ``wx.DateTime.Sunday_First`` are not well-defined as the ISO definition quoted above applies to the weeks starting on Monday only. **Parameters:** * `flags` (int) * `tz` (int) | **Returns:** `int` -------- .. method:: GetYear() Returns the year in the given timezone (local one by default). | **Returns:** `int` -------- .. method:: GetYearDay(yday) Returns the copy of this object to which `SetToYearDay <#SetToYearDay>`_ was applied. **Parameters:** * `yday` (int) | **Returns:** `wx.DateTime `_ -------- .. method:: IsBetween(t1, t2) Returns ``True`` if `IsStrictlyBetween <#IsStrictlyBetween>`_ is ``True`` or if the date is equal to one of the limit values. **Parameters:** * `t1` (`wx.DateTime `_) * `t2` (`wx.DateTime `_) | **Returns:** `bool` .. seealso:: `IsStrictlyBetween <#IsStrictlyBetween>`_ -------- .. method:: IsDST(country=wx.DateTime.Country_Default) Returns ``True`` if the DST is applied for this date in the given country. **Parameters:** * `country` (int) | **Returns:** `int` -------- .. method:: IsDSTApplicable(year=wx.DateTime.Inv_Year, country=wx.DateTime.Country_Default) Returns ``True`` if DST was used n the given year (the current one by default) in the given country. **Parameters:** * `year` (int) * `country` (int) | **Returns:** `bool` -------- .. method:: IsEarlierThan(datetime) Returns ``True`` if this date precedes the given one. **Parameters:** * `datetime` (`wx.DateTime `_) | **Returns:** `bool` -------- .. method:: IsEqualTo(datetime) Returns ``True`` if the two dates are strictly identical. **Parameters:** * `datetime` (`wx.DateTime `_) | **Returns:** `bool` -------- .. method:: IsEqualUpTo(dt, ts) Returns ``True`` if the date is equal to another one up to the given time interval, i.e. if the absolute difference between the two dates is less than this interval. **Parameters:** * `dt` (`wx.DateTime `_) * `ts` (`wx.TimeSpan `_) | **Returns:** `bool` -------- .. method:: IsLaterThan(datetime) Returns ``True`` if this date is later than the given one. **Parameters:** * `datetime` (`wx.DateTime `_) | **Returns:** `bool` -------- .. method:: IsLeapYear(year=wx.DateTime.Inv_Year, cal=wx.DateTime.Gregorian) Returns ``True`` if the `year` is a leap one in the specified calendar. This functions supports Gregorian and Julian calendars. **Parameters:** * `year` (int) * `cal` (int) | **Returns:** `bool` -------- .. method:: IsSameDate(dt) Returns ``True`` if the date is the same without comparing the time parts. **Parameters:** * `dt` (`wx.DateTime `_) | **Returns:** `bool` -------- .. method:: IsSameTime(dt) Returns ``True`` if the time is the same (although dates may differ). **Parameters:** * `dt` (`wx.DateTime `_) | **Returns:** `bool` -------- .. method:: IsStrictlyBetween(t1, t2) Returns ``True`` if this date lies strictly between the two others, **Parameters:** * `t1` (`wx.DateTime `_) * `t2` (`wx.DateTime `_) | **Returns:** `bool` .. seealso:: `IsBetween <#IsBetween>`_ -------- .. method:: IsValid() Returns ``True`` if the object represents a valid time moment. | **Returns:** `bool` -------- .. method:: IsWestEuropeanCountry(country=wx.DateTime.Country_Default) This function returns ``True`` if the specified (or default) country is one of Western European ones. It is used internally by `wx.DateTime` to determine the DST convention and date and time formatting rules. **Parameters:** * `country` (int) | **Returns:** `bool` -------- .. method:: IsWorkDay(country=wx.DateTime.Country_Default) Returns ``True`` is this day is not a holiday in the given country. **Parameters:** * `country` (int) | **Returns:** `bool` -------- .. method:: MakeFromTimezone() Same as `FromTimezone <#FromTimezone>`_ but modifies the object in place. | **Returns:** `wx.DateTime `_ -------- .. method:: MakeFromUTC(noDST=False) | **Parameters:** * `noDST` (bool) | **Returns:** `wx.DateTime `_ -------- .. method:: MakeGMT(noDST=False) | **Parameters:** * `noDST` (bool) | **Returns:** `wx.DateTime `_ -------- .. method:: MakeTimezone(noDST=False) Modifies the object in place to represent the date in another time zone. If `noDST` is ``True``, no DST adjustments will be made. | **Returns:** `wx.DateTime `_ -------- .. method:: MakeUTC(noDST=False) This is the same as calling `MakeTimezone <#MakeTimezone>`_ with the argument `wx.DateTime.GMT0`. **Parameters:** * `noDST` (bool) | **Returns:** `wx.DateTime `_ -------- .. method:: Now() Returns the object corresponding to the current time. | **Returns:** `wx.DateTime `_ .. note:: Note that this function is accurate up to second: `UNow <#UNow>`_ should be used for better precision (but it is less efficient and might not be available on all platforms). .. seealso:: `Today <#Today>`_ -------- .. method:: ParseDate(date) This function is like `ParseDateTime <#ParseDateTime>`_, but it only allows the date to be specified. It is thus less flexible then `ParseDateTime <#ParseDateTime>`_, but also has less chances to misinterpret the user input. Returns ``None`` if the conversion failed, otherwise return the pointer to the character which stopped the scan. **Parameters:** * `date` (string) | **Returns:** `string` -------- .. method:: ParseDateTime(datetime) Parses the string `datetime` containing the date and time in free format. This function tries as hard as it can to interpret the given string as date and time. Unlike `ParseRfc822Date <#ParseRfc822Date>`_, it will accept anything that may be accepted and will only reject strings which can not be parsed in any way at all. Returns ``None`` if the conversion failed, otherwise return the pointer to the character which stopped the scan. **Parameters:** * `datetime` (string) | **Returns:** `string` -------- .. method:: ParseFormat(date, format=wx.DefaultDateTimeFormat, dateDef=wx.DefaultDateTime) This function parses the string `date` according to the given `format`. The system ``strptime(3)`` function is used whenever available, but even if it is not, this function is still implemented, although support for locale-dependent format specifiers such as ``"%c"``, ``"%x"`` or ``"%X"`` may not be perfect and GNU extensions such as ``"%z"`` and ``"%Z"`` are not implemented. This function does handle the month and weekday names in the current locale on all platforms, however. Please see the description of the ANSI C function ``strftime(3)`` for the syntax of the format string. The `dateDef` parameter is used to fill in the fields which could not be determined from the format string. For example, if the format is ``"%d"`` (the ay of the month), the month and the year are taken from `dateDef`. If it is not specified, `Today <#Today>`_ is used as the default date. Returns ``None`` if the conversion failed, otherwise return the pointer to the character which stopped the scan. **Parameters:** * `date` (string) * `format` (string) * `dateDef` (`wx.DateTime `_) | **Returns:** `string` -------- .. method:: ParseRfc822Date(date) Parses the string `date` looking for a date formatted according to the RFC 822 in it. The exact description of this format may, of course, be found in the RFC (section 5), but, briefly, this is the format used in the headers of Internet email messages and one of the most common strings expressing date in this format may be something like ``"Sat, 18 Dec 1999 00:48:30 +0100"``. Returns ``None`` if the conversion failed, otherwise return the pointer to the character immediately following the part of the string which could be parsed. If the entire string contains only the date in RFC 822 format, the returned pointer will be pointing to a ``NULL`` character. This function is intentionally strict, it will return an error for any string which is not RFC 822 compliant. If you need to parse date formatted in more free ways, you should use `ParseDateTime <#ParseDateTime>`_ or `ParseDate <#ParseDate>`_ instead. **Parameters:** * `date` (string) | **Returns:** `string` -------- .. method:: ParseTime(time) This functions is like `ParseDateTime <#ParseDateTime>`_, but only allows the time to be specified in the input string. Returns ``None`` if the conversion failed, otherwise return the pointer to the character which stopped the scan. **Parameters:** * `time` (string) | **Returns:** `string` -------- .. method:: ResetTime() Reset time to midnight (00:00:00) without changing the date. | **Returns:** `wx.DateTime `_ -------- .. method:: Set(day, month=wx.DateTime.Inv_Month, year=wx.DateTime.Inv_Year, hour=0, minute=0, second=0, millisec=0) Sets the date and time from the parameters. **Parameters:** * `day` (int) * `month` (int) * `year` (int) * `hour` (int) * `minute` (int) * `second` (int) * `millisecond` (int) | **Returns:** `wx.DateTime `_ -------- .. method:: SetCountry(country) Sets the country to use by default. This setting influences the DST calculations, date formatting and other things. **Parameters:** * `country` (int) .. seealso:: `GetCountry <#GetCountry>`_ -------- .. method:: SetDay(day) Sets the day without changing other date components. **Parameters:** * `day` (int) | **Returns:** `wx.DateTime `_ -------- .. method:: SetHMS(hour, minute=0, second=0, millisec=0) | **Parameters:** * `hour` (int) * `minute` (int) * `second` (int) * `millisec` (int) | **Returns:** `wx.DateTime `_ -------- .. method:: SetHour(hour) Sets the hour without changing other date components. **Parameters:** * `hour` (int) | **Returns:** `wx.DateTime `_ -------- .. method:: SetJDN(jdn) | **Parameters:** * `jdn` (double) | **Returns:** `wx.DateTime `_ -------- .. method:: SetMillisecond(millisecond) Sets the millisecond without changing other date components. **Parameters:** * `millisecond` (int) | **Returns:** `wx.DateTime `_ -------- .. method:: SetMinute(minute) Sets the minute without changing other date components. **Parameters:** * `minute` (int) | **Returns:** `wx.DateTime `_ -------- .. method:: SetMonth(month) Sets the month without changing other date components. **Parameters:** * `month` (int) | **Returns:** `wx.DateTime `_ -------- .. method:: SetSecond(second) Sets the second without changing other date components. **Parameters:** * `second` (int) | **Returns:** `wx.DateTime `_ -------- .. method:: SetTimeT(timet) | **Parameters:** * `timet` (time_t) | **Returns:** `wx.DateTime `_ -------- .. method:: SetToCurrent() Sets the date and time of to the current values. Same as assigning the result of `Now <#Now>`_ to this object. | **Returns:** `wx.DateTime `_ -------- .. method:: SetToLastMonthDay(month=wx.DateTime.Inv_Month, year=wx.DateTime.Inv_Year) Sets the date to the last day in the specified month (the current one by default). Returns the reference to the modified object itself. **Parameters:** * `month` (int) * `year` (int) | **Returns:** `wx.DateTime `_ -------- .. method:: SetToLastWeekDay(weekday, month=wx.DateTime.Inv_Month, year=wx.DateTime.Inv_Year) The effect of calling this function is the same as of calling `SetToWeekDay <#SetToWeekDay>`_ (-1, weekday, month, year). The date will be set to the last `weekday` in the given month and year (the current ones by default). Always returns ``True``. **Parameters:** * `weekday` (int) * `month` (int) * `year` (int) | **Returns:** `bool` -------- .. method:: SetToNextWeekDay(weekday) Sets the date so that it will be the first `weekday` following the current date. Returns the reference to the modified object itself. **Parameters:** * `weekday` (int) | **Returns:** `wx.DateTime `_ -------- .. method:: SetToPrevWeekDay(weekday) Sets the date so that it will be the last `weekday` before the current date. Returns the reference to the modified object itself. **Parameters:** * `weekday` (int) | **Returns:** `wx.DateTime `_ -------- .. method:: SetToWeekDay(weekday, n=1, month=wx.DateTime.Inv_Month, year=wx.DateTime.Inv_Year) Sets the date to the `n` -th `weekday` in the given month of the given year (the current month and year are used by default). The parameter `n` may be either positive (counting from the beginning of the month) or negative (counting from the end of it). For example, `SetToWeekDay(2, wx.DateTime.Wed)` will set the date to the second Wednesday in the current month and `SetToWeekDay(-1, wx.DateTime.Sun)` -- to the last Sunday in it. Returns ``True`` if the date was modified successfully, ``False`` otherwise meaning that the specified date doesn't exist. **Parameters:** * `weekday` (int) * `n` (int) * `month` (int) * `year` (int) | **Returns:** `bool` -------- .. method:: SetToWeekDayInSameWeek(weekday, flags=wx.DateTime.Monday_First) Adjusts the date so that it will still lie in the same week as before, but its week day will be the given one. Returns the reference to the modified object itself. **Parameters:** * `weekday` (int) * `flags` (int) | **Returns:** `wx.DateTime `_ -------- .. method:: SetToWeekOfYear(year, numWeek, weekday=wx.DateTime.Mon) Set the date to the given `weekday` in the week number `numWeek` of the given `year`. The number should be in range 1...53. **Parameters:** * `year` (int) * `numWeek` (int) * `weekday` (int) | **Returns:** `wx.DateTime `_ .. note:: Note that the returned date may be in a different year than the one passed to this function because both the week 1 and week 52 or 53 (for leap years) contain days from different years. See `GetWeekOfYear <#GetWeekOfYear>`_ for the explanation of how the year weeks are counted. -------- .. method:: SetToYearDay(yday) Sets the date to the day number `yday` in the same year (i.e., unlike the other functions, this one does not use the current year). The day number should be in the range 1...366 for the leap years and 1...365 for the other ones. Returns the reference to the modified object itself. **Parameters:** * `yday` (int) | **Returns:** `wx.DateTime `_ -------- .. method:: SetYear(year) Sets the year without changing other date components. **Parameters:** * `year` (int) | **Returns:** `wx.DateTime `_ -------- .. method:: Subtract(dt) Subtracts another date from this one and returns the difference between them as `wx.TimeSpan `_. **Parameters:** * `dt` (`wx.DateTime `_) | **Returns:** `wx.TimeSpan `_ -------- .. method:: SubtractDS(diff) Subtracts the `wx.DateSpan `_ `diff` from self. **Parameters:** * `diff` (`wx.DateSpan `_) | **Returns:** `wx.DateTime `_ -------- .. method:: SubtractTS(diff) Subtracts the `wx.TimeSpan `_ `diff` from self. **Parameters:** * `diff` (`wx.TimeSpan `_) | **Returns:** `wx.DateTime `_ -------- .. method:: ToGMT(noDST=False) | **Parameters:** * `noDST` (bool) | **Returns:** `wx.DateTime `_ -------- .. method:: ToTimezone(noDST=False) Transform the date to the given time zone. If `noDST` is ``True``, no DST adjustments will be made. Returns the date in the new time zone. | **Returns:** `wx.DateTime `_ -------- .. method:: ToUTC(noDST=False) This is the same as calling `ToTimezone <#ToTimezone>`_ with the argument `wx.DateTime.GMT0`. **Parameters:** * `noDST` (bool) | **Returns:** `wx.DateTime `_ -------- .. method:: Today() Returns the object corresponding to the midnight of the current day (i.e. the same as `Now <#Now>`_, but the time part is set to 0). | **Returns:** `wx.DateTime `_ .. seealso:: `Now <#Now>`_ -------- .. method:: UNow() Returns the object corresponding to the current time including the milliseconds if a function to get time with such precision is available on the current platform (supported under most Unices and Win32). | **Returns:** `wx.DateTime `_ .. seealso:: `Now <#Now>`_ -------- Properties ^^^^^^^^^^ .. attribute:: Day See `GetDay <#GetDay>`_ and `SetDay <#SetDay>`_ .. attribute:: DayOfYear See `GetDayOfYear <#GetDayOfYear>`_ .. attribute:: Hour See `GetHour <#GetHour>`_ and `SetHour <#SetHour>`_ .. attribute:: JDN See `GetJDN <#GetJDN>`_ and `SetJDN <#SetJDN>`_ .. attribute:: JulianDayNumber See `GetJulianDayNumber <#GetJulianDayNumber>`_ .. attribute:: LastMonthDay See `GetLastMonthDay <#GetLastMonthDay>`_ .. attribute:: LastWeekDay See `GetLastWeekDay <#GetLastWeekDay>`_ .. attribute:: MJD See `GetMJD <#GetMJD>`_ .. attribute:: Millisecond See `GetMillisecond <#GetMillisecond>`_ and `SetMillisecond <#SetMillisecond>`_ .. attribute:: Minute See `GetMinute <#GetMinute>`_ and `SetMinute <#SetMinute>`_ .. attribute:: ModifiedJulianDayNumber See `GetModifiedJulianDayNumber <#GetModifiedJulianDayNumber>`_ .. attribute:: Month See `GetMonth <#GetMonth>`_ and `SetMonth <#SetMonth>`_ .. attribute:: NextWeekDay See `GetNextWeekDay <#GetNextWeekDay>`_ .. attribute:: PrevWeekDay See `GetPrevWeekDay <#GetPrevWeekDay>`_ .. attribute:: RataDie See `GetRataDie <#GetRataDie>`_ .. attribute:: Second See `GetSecond <#GetSecond>`_ and `SetSecond <#SetSecond>`_ .. attribute:: Ticks See `GetTicks <#GetTicks>`_ .. attribute:: Week See `GetWeek` .. attribute:: WeekDay See `GetWeekDay <#GetWeekDay>`_ .. attribute:: WeekDayInSameWeek See `GetWeekDayInSameWeek <#GetWeekDayInSameWeek>`_ .. attribute:: WeekOfMonth See `GetWeekOfMonth <#GetWeekOfMonth>`_ .. attribute:: WeekOfYear See `GetWeekOfYear <#GetWeekOfYear>`_ .. attribute:: Year See `GetYear <#GetYear>`_ and `SetYear <#SetYear>`_ .. attribute:: YearDay See `GetYearDay <#GetYearDay>`_