.. wxPython Phoenix documentation

   This file was generated by Phoenix's sphinx generator and associated
   tools, do not edit by hand.

   Copyright: (c) 2011-2017 by Total Control Software
   License:   wxWindows License

.. include:: headings.inc



.. _wx.DateTime:

==========================================================================================================================================
|phoenix_title|  **wx.DateTime**
==========================================================================================================================================

:ref:`wx.DateTime`  class represents an absolute moment in time.          

The type  ``DateTime_t``   is typedefed as   ``unsigned short``   and is used to contain the number of years, hours, minutes, seconds and milliseconds. 

Global constant :ref:`wx.DefaultDateTime`  and synonym for it :ref:`wx.InvalidDateTime`  are defined. This constant will be different from any valid :ref:`wx.DateTime`  object. 



|phoenix_title| Static Functions
================================

All static functions either set or return the static variables of :ref:`wx.DateSpan`  (the country), return the current moment, year, month or number of days in it, or do some general calendar-related actions. Please note that although several function accept an extra Calendar parameter, it is currently ignored as only the Gregorian calendar is supported. Future versions will support other calendars.  



|phoenix_title| Date Formatting and Parsing
===========================================

The date formatting and parsing functions convert :ref:`wx.DateTime`  objects to and from text. The conversions to text are mostly trivial: you can either do it using the default date and time representations for the current locale (:meth:`~wx.DateTime.FormatDate`  and :meth:`~wx.DateTime.FormatTime`), using the international standard representation defined by ``ISO`` 8601 (:meth:`~wx.DateTime.FormatISODate`, :meth:`~wx.DateTime.FormatISOTime`  and :meth:`~wx.DateTime.FormatISOCombined`) or by specifying any format at all and using :meth:`~wx.DateTime.Format`  directly. The conversions from text are more interesting, as there are much more possibilities to care about. The simplest cases can be taken care of with :meth:`~wx.DateTime.ParseFormat`  which can parse any date in the given (rigid) format. :meth:`~wx.DateTime.ParseRfc822Date`  is another function for parsing dates in predefined format  ``strptime(3)-like``   format strings used by  :meth:`~wx.DateTime.Format`, hence the need for a separate function. But the most interesting functions are :meth:`~wx.DateTime.ParseTime`, :meth:`~wx.DateTime.ParseDate`  and :meth:`~wx.DateTime.ParseDateTime`. They try to parse the date and time (or only one of them) in 'free' format, i.e. allow them to be specified in any of possible ways. These functions will usually be used to parse the (interactive) user input which is not bound to be in any predefined format. As an example, :meth:`~wx.DateTime.ParseDate`  can parse the strings such as "tomorrow", "March first" and even "next Sunday". Finally notice that each of the parsing functions is available in several overloads: if the input string is a narrow ( ``char``   ) string, then a narrow pointer is returned. If the input string is a wide string, a wide int pointer is returned. Finally, if the input parameter is a  :ref:`String`, a narrow int pointer is also returned for backwards compatibility but there is also an additional argument of `String.const_iterator` type in which, if it is not ``None``, an iterator pointing to the end of the scanned string part is returned.   



.. seealso:: :ref:`Date and Time <date and time>`, :ref:`wx.TimeSpan`, :ref:`wx.DateSpan`, :ref:`wx.adv.CalendarCtrl`    







|

|class_hierarchy| Class Hierarchy
=================================

.. raw:: html

   <div id="toggleBlock" onclick="return toggleVisibility(this)" class="closed" style="cursor:pointer;">
   <img id="toggleBlock-trigger" src="_static/images/closed.png"/>
   Inheritance diagram for class <strong>DateTime</strong>:
   </div>
   <div id="toggleBlock-summary" style="display:block;"></div>
   <div id="toggleBlock-content" style="display:none;">
   <p class="graphviz">
   <center><img src="_static/images/inheritance/wx.DateTime_inheritance.png" alt="Inheritance diagram of DateTime" usemap="#dummy" class="inheritance"/></center>
   </div>
   <script type="text/javascript">toggleVisibilityOnLoad(document.getElementById('toggleBlock'))</script>
   <map id="dummy" name="dummy"> <area shape="rect" id="node1" href="wx.DateTime.html" title="wx.DateTime" alt="" coords="5,5,109,35"/> </map> 
   </p>

|


|method_summary| Methods Summary
================================

================================================================================ ================================================================================
:meth:`~wx.DateTime.__init__`                                                    Default constructor.
:meth:`~wx.DateTime.Add`                                                         Adds the given date span to this object.
:meth:`~wx.DateTime.ConvertYearToBC`                                             Converts the year in absolute notation (i.e. a number which can be negative, positive or zero) to the year in BC/AD notation.
:meth:`~wx.DateTime.DiffAsDateSpan`                                              Returns the difference between this object and `dt`  as a :ref:`wx.DateSpan`.
:meth:`~wx.DateTime.Format`                                                      This function does the same as the standard ``ANSI`` C  ``strftime(3)``   function (`http://www.cplusplus.com/reference/clibrary/ctime/strftime.html <http://www.cplusplus.com/reference/clibrary/ctime/strftime.html>`_).
:meth:`~wx.DateTime.FormatDate`                                                  Identical to calling :meth:`~DateTime.Format`   with  ``"%x"``   argument (which means "preferred date representation for the current locale").
:meth:`~wx.DateTime.FormatISOCombined`                                           Returns the combined date-time representation in the ``ISO`` 8601 format  ``"YYYY-MM-DDTHH:MM:SS"`` .
:meth:`~wx.DateTime.FormatISODate`                                               This function returns the date representation in the ``ISO`` 8601 format  ``"YYYY-MM-DD"`` .
:meth:`~wx.DateTime.FormatISOTime`                                               This function returns the time representation in the ``ISO`` 8601 format  ``"HH:MM:SS"`` .
:meth:`~wx.DateTime.FormatTime`                                                  Identical to calling :meth:`~DateTime.Format`   with  ``"%X"``   argument (which means "preferred time representation for the current locale").
:meth:`~wx.DateTime.FromDMY`                                                     Construct a :class:`DateTime` using the supplied parameters.
:meth:`~wx.DateTime.FromHMS`                                                     Construct a :class:`DateTime` equal to :meth:`~DateTime.Today` () with the time set to the supplied parameters.
:meth:`~wx.DateTime.FromJDN`                                                     Construct a :class:`DateTime` from a Julian Day Number.
:meth:`~wx.DateTime.FromTimeT`                                                   Construct a :class:`DateTime` from a C ``time_t`` value, the number of seconds since the epoch.
:meth:`~wx.DateTime.FromTimezone`                                                Transform the date from the given time zone to the local one.
:meth:`~wx.DateTime.GetAmPmStrings`                                              Returns the translations of the strings  ``AM``   and   ``PM``   used for time formatting for the current locale.
:meth:`~wx.DateTime.GetAsDOS`                                                    Returns the date and time in ``DOS`` format.
:meth:`~wx.DateTime.GetBeginDST`                                                 Get the beginning of ``DST`` for the given country in the given year (current one by default).
:meth:`~wx.DateTime.GetCentury`                                                  Returns the century of this date.
:meth:`~wx.DateTime.GetCountry`                                                  Returns the current default country.
:meth:`~wx.DateTime.GetCurrentMonth`                                             Get the current month in given calendar (only Gregorian is currently supported).
:meth:`~wx.DateTime.GetCurrentYear`                                              Get the current year in given calendar (only Gregorian is currently supported).
:meth:`~wx.DateTime.GetDateOnly`                                                 Returns the object having the same date component as this one but time of 00:00:00.
:meth:`~wx.DateTime.GetDay`                                                      Returns the day in the given timezone (local one by default).
:meth:`~wx.DateTime.GetDayOfYear`                                                Returns the day of the year (in ``1-366`` range) in the given timezone (local one by default).
:meth:`~wx.DateTime.GetEndDST`                                                   Returns the end of ``DST`` for the given country in the given year (current one by default).
:meth:`~wx.DateTime.GetEnglishMonthName`                                         Return the standard English name of the given month.
:meth:`~wx.DateTime.GetEnglishWeekDayName`                                       Return the standard English name of the given week day.
:meth:`~wx.DateTime.GetHour`                                                     Returns the hour in the given timezone (local one by default).
:meth:`~wx.DateTime.GetJDN`                                                      Synonym for :meth:`~DateTime.GetJulianDayNumber` .
:meth:`~wx.DateTime.GetJulianDayNumber`                                          Returns the ``JDN`` corresponding to this date.
:meth:`~wx.DateTime.GetLastMonthDay`                                             Returns the copy of this object to which :meth:`~DateTime.SetToLastMonthDay`   was applied.
:meth:`~wx.DateTime.GetLastWeekDay`                                              Returns the copy of this object to which :meth:`~DateTime.SetToLastWeekDay`   was applied.
:meth:`~wx.DateTime.GetMJD`                                                      Synonym for :meth:`~DateTime.GetModifiedJulianDayNumber` .
:meth:`~wx.DateTime.GetMillisecond`                                              Returns the milliseconds in the given timezone (local one by default).
:meth:`~wx.DateTime.GetMinute`                                                   Returns the minute in the given timezone (local one by default).
:meth:`~wx.DateTime.GetModifiedJulianDayNumber`                                  Returns the `"Modified Julian Day Number"`  (``MJD``) which is, by definition, is equal to ``JDN`` - 2400000.5.
:meth:`~wx.DateTime.GetMonth`                                                    Returns the month in the given timezone (local one by default).
:meth:`~wx.DateTime.GetMonthName`                                                Gets the full (default) or abbreviated name of the given month.
:meth:`~wx.DateTime.GetNextWeekDay`                                              Returns the copy of this object to which :meth:`~DateTime.SetToNextWeekDay`   was applied.
:meth:`~wx.DateTime.GetNumberOfDays`                                             Returns the number of days in the given month of the given year.
:meth:`~wx.DateTime.GetPrevWeekDay`                                              Returns the copy of this object to which :meth:`~DateTime.SetToPrevWeekDay`   was applied.
:meth:`~wx.DateTime.GetRataDie`                                                  Return the `Rata`  Die number of this date.
:meth:`~wx.DateTime.GetSecond`                                                   Returns the seconds in the given timezone (local one by default).
:meth:`~wx.DateTime.GetTicks`                                                    Returns the number of seconds since Jan 1, 1970 ``UTC``.
:meth:`~wx.DateTime.GetTimeNow`                                                  Returns the current time.
:meth:`~wx.DateTime.GetTm`                                                       Returns broken down representation of the date and time.
:meth:`~wx.DateTime.GetWeekDay`                                                  Returns the week day in the given timezone (local one by default).
:meth:`~wx.DateTime.GetWeekDayInSameWeek`                                        Returns the copy of this object to which :meth:`~DateTime.SetToWeekDayInSameWeek`   was applied.
:meth:`~wx.DateTime.GetWeekDayName`                                              Gets the full (default) or abbreviated name of the given week day.
:meth:`~wx.DateTime.GetWeekOfMonth`                                              Returns the ordinal number of the week in the month (in ``1-5`` range).
:meth:`~wx.DateTime.GetWeekOfYear`                                               Returns the number of the week of the year this date is in.
:meth:`~wx.DateTime.GetYear`                                                     Returns the year in the given timezone (local one by default).
:meth:`~wx.DateTime.GetYearDay`                                                  Returns the copy of this object to which :meth:`~DateTime.SetToYearDay`   was applied.
:meth:`~wx.DateTime.IsBetween`                                                   Returns ``True`` if :meth:`~DateTime.IsStrictlyBetween`   is ``True`` or if the date is equal to one of the limit values.
:meth:`~wx.DateTime.IsDST`                                                       Returns ``True`` if the ``DST`` is applied for this date in the given country.
:meth:`~wx.DateTime.IsDSTApplicable`                                             Returns ``True`` if ``DST`` was used in the given year (the current one by default) in the given country.
:meth:`~wx.DateTime.IsEarlierThan`                                               Returns ``True`` if this date precedes the given one.
:meth:`~wx.DateTime.IsEqualTo`                                                   Returns ``True`` if the two dates are strictly identical.
:meth:`~wx.DateTime.IsEqualUpTo`                                                 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.
:meth:`~wx.DateTime.IsLaterThan`                                                 Returns ``True`` if this date is later than the given one.
:meth:`~wx.DateTime.IsLeapYear`                                                  Returns ``True`` if the `year`  is a leap one in the specified calendar.
:meth:`~wx.DateTime.IsSameDate`                                                  Returns ``True`` if the date is the same without comparing the time parts.
:meth:`~wx.DateTime.IsSameTime`                                                  Returns ``True`` if the time is the same (although dates may differ).
:meth:`~wx.DateTime.IsStrictlyBetween`                                           Returns ``True`` if this date lies strictly between the two given dates.
:meth:`~wx.DateTime.IsValid`                                                     Returns ``True`` if the object represents a valid time moment.
:meth:`~wx.DateTime.IsWestEuropeanCountry`                                       This function returns ``True`` if the specified (or default) country is one of Western European ones.
:meth:`~wx.DateTime.IsWorkDay`                                                   Returns ``True`` is this day is not a holiday in the given country.
:meth:`~wx.DateTime.MakeFromTimezone`                                            Same as :meth:`~DateTime.FromTimezone`   but modifies the object in place.
:meth:`~wx.DateTime.MakeTimezone`                                                Modifies the object in place to represent the date in another time zone.
:meth:`~wx.DateTime.MakeUTC`                                                     This is the same as calling :meth:`~DateTime.MakeTimezone`   with the argument  ``GMT0`` .
:meth:`~wx.DateTime.Now`                                                         Returns the object corresponding to the current time.
:meth:`~wx.DateTime.ParseDate`                                                   This function is like :meth:`~DateTime.ParseDateTime` , but it only allows the date to be specified.
:meth:`~wx.DateTime.ParseDateTime`                                               Parses the string `datetime`  containing the date and time in free format.
:meth:`~wx.DateTime.ParseFormat`                                                 This function parses the string `date`  according to the given `format`.
:meth:`~wx.DateTime.ParseISOCombined`                                            This function parses the string containing the date and time in ``ISO`` 8601 combined format  ``"YYYY-MM-DDTHH:MM:SS"`` .
:meth:`~wx.DateTime.ParseISODate`                                                This function parses the date in ``ISO`` 8601 format  ``"YYYY-MM-DD"`` .
:meth:`~wx.DateTime.ParseISOTime`                                                This function parses the time in ``ISO`` 8601 format  ``"HH:MM:SS"`` .
:meth:`~wx.DateTime.ParseRfc822Date`                                             Parses the string `date`  looking for a date formatted according to the ``RFC`` 822 in it.
:meth:`~wx.DateTime.ParseTime`                                                   This functions is like :meth:`~DateTime.ParseDateTime` , but only allows the time to be specified in the input string.
:meth:`~wx.DateTime.ResetTime`                                                   Reset time to midnight (00:00:00) without changing the date.
:meth:`~wx.DateTime.Set`                                                         Sets the date and time from the parameters.
:meth:`~wx.DateTime.SetHMS`                                                      Sets the date to be equal to :meth:`~DateTime.Today`   and the time from supplied parameters.
:meth:`~wx.DateTime.SetJDN`                                                      Sets the date from the so-called Julian Day Number.
:meth:`~wx.DateTime.SetTimeT`                                                    Constructs the object from `timet`  value holding the number of seconds since Jan 1, 1970 ``UTC``.
:meth:`~wx.DateTime.SetTm`                                                       Sets the date and time from the broken down representation in the  ` :meth:`wx.DateTime.Tm`  `   structure.
:meth:`~wx.DateTime.SetCountry`                                                  Sets the country to use by default.
:meth:`~wx.DateTime.SetDay`                                                      Sets the day without changing other date components.
:meth:`~wx.DateTime.SetFromDOS`                                                  Sets the date from the date and time in ``DOS`` format.
:meth:`~wx.DateTime.SetHour`                                                     Sets the hour without changing other date components.
:meth:`~wx.DateTime.SetMillisecond`                                              Sets the millisecond without changing other date components.
:meth:`~wx.DateTime.SetMinute`                                                   Sets the minute without changing other date components.
:meth:`~wx.DateTime.SetMonth`                                                    Sets the month without changing other date components.
:meth:`~wx.DateTime.SetSecond`                                                   Sets the second without changing other date components.
:meth:`~wx.DateTime.SetToCurrent`                                                Sets the date and time of to the current values.
:meth:`~wx.DateTime.SetToLastMonthDay`                                           Sets the date to the last day in the specified month (the current one by default).
:meth:`~wx.DateTime.SetToLastWeekDay`                                            The effect of calling this function is the same as of calling  ``SetToWeekDay`` (-1, weekday, month, year).
:meth:`~wx.DateTime.SetToNextWeekDay`                                            Sets the date so that it will be the first `weekday`  following the current date.
:meth:`~wx.DateTime.SetToPrevWeekDay`                                            Sets the date so that it will be the last `weekday`  before the current date.
:meth:`~wx.DateTime.SetToWeekDay`                                                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).
:meth:`~wx.DateTime.SetToWeekDayInSameWeek`                                      Adjusts the date so that it will still lie in the same week as before, but its week day will be the given one.
:meth:`~wx.DateTime.SetToWeekOfYear`                                             Set the date to the given `weekday`  in the week number `numWeek`  of the given `year`  .
:meth:`~wx.DateTime.SetToYearDay`                                                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).
:meth:`~wx.DateTime.SetYear`                                                     Sets the year without changing other date components.
:meth:`~wx.DateTime.Subtract`                                                    Subtracts the given time span from this object.
:meth:`~wx.DateTime.ToTimezone`                                                  Transform the date to the given time zone.
:meth:`~wx.DateTime.ToUTC`                                                       This is the same as calling :meth:`~DateTime.ToTimezone`   with the argument  ``GMT0`` .
:meth:`~wx.DateTime.Today`                                                       Returns the object corresponding to the midnight of the current day (i.e. the same as :ref:`wx.Now`, but the time part is set to 0).
:meth:`~wx.DateTime.UNow`                                                        Returns the object corresponding to the current ``UTC`` time including the milliseconds.
:meth:`~wx.DateTime.__repr__`                                                    
:meth:`~wx.DateTime.__str__`                                                     
================================================================================ ================================================================================


|


|property_summary| Properties Summary
=====================================

================================================================================ ================================================================================
:attr:`~wx.DateTime.DayOfYear`                                                   See :meth:`~wx.DateTime.GetDayOfYear`
:attr:`~wx.DateTime.JDN`                                                         See :meth:`~wx.DateTime.GetJDN` and :meth:`~wx.DateTime.SetJDN`
:attr:`~wx.DateTime.JulianDayNumber`                                             See :meth:`~wx.DateTime.GetJulianDayNumber`
:attr:`~wx.DateTime.LastMonthDay`                                                See :meth:`~wx.DateTime.GetLastMonthDay`
:attr:`~wx.DateTime.MJD`                                                         See :meth:`~wx.DateTime.GetMJD`
:attr:`~wx.DateTime.ModifiedJulianDayNumber`                                     See :meth:`~wx.DateTime.GetModifiedJulianDayNumber`
:attr:`~wx.DateTime.RataDie`                                                     See :meth:`~wx.DateTime.GetRataDie`
:attr:`~wx.DateTime.Ticks`                                                       See :meth:`~wx.DateTime.GetTicks`
:attr:`~wx.DateTime.WeekOfMonth`                                                 See :meth:`~wx.DateTime.GetWeekOfMonth`
:attr:`~wx.DateTime.WeekOfYear`                                                  See :meth:`~wx.DateTime.GetWeekOfYear`
:attr:`~wx.DateTime.day`                                                         See :meth:`~wx.DateTime.GetDay` and :meth:`~wx.DateTime.SetDay`
:attr:`~wx.DateTime.hour`                                                        See :meth:`~wx.DateTime.GetHour` and :meth:`~wx.DateTime.SetHour`
:attr:`~wx.DateTime.millisecond`                                                 See :meth:`~wx.DateTime.GetMillisecond` and :meth:`~wx.DateTime.SetMillisecond`
:attr:`~wx.DateTime.minute`                                                      See :meth:`~wx.DateTime.GetMinute` and :meth:`~wx.DateTime.SetMinute`
:attr:`~wx.DateTime.month`                                                       See :meth:`~wx.DateTime.GetMonth` and :meth:`~wx.DateTime.SetMonth`
:attr:`~wx.DateTime.second`                                                      See :meth:`~wx.DateTime.GetSecond` and :meth:`~wx.DateTime.SetSecond`
:attr:`~wx.DateTime.year`                                                        See :meth:`~wx.DateTime.GetYear` and :meth:`~wx.DateTime.SetYear`
================================================================================ ================================================================================


|


|api| Class API
===============


.. class:: wx.DateTime(object)

   **Possible constructors**::

       DateTime()
       
       DateTime(date)
       
       DateTime(day, month, year=Inv_Year, hour=0, minute=0, second=0,
                millisec=0)
       
   
   DateTime class represents an absolute moment in time.



   .. method:: __init__(self, *args, **kw)



      |overload| Overloaded Implementations:

      **~~~**

      
      **__init__** `(self)`
      
      Default constructor.                  
      
      Use one of the :meth:`Set`   functions to initialize the object later.                   
      
      
      
      
      **~~~**

      
      **__init__** `(self, date)`
      
      Copy constructor.                  
      
      
      :param `date`: 
      :type `date`: wx.DateTime
      
      
      
      
      
      
      **~~~**

      
      **__init__** `(self, day, month, year=Inv_Year, hour=0, minute=0, second=0, millisec=0)`
      
      Same as :meth:`Set` .                  
      
      
      :param `day`: 
      :type `day`: int
      :param `month`: 
      :type `month`: DateTime.Month
      :param `year`: 
      :type `year`: int
      :param `hour`: 
      :type `hour`: int
      :param `minute`: 
      :type `minute`: int
      :param `second`: 
      :type `second`: int
      :param `millisec`: 
      :type `millisec`: int
      
      
      
      
      
      
      **~~~**






   .. method:: Add(self, *args, **kw)



      |overload| Overloaded Implementations:

      **~~~**

      
      **Add** `(self, diff)`
      
      Adds the given date span to this object.                  
      
      
      :param `diff`: 
      :type `diff`: wx.DateSpan
      
      
      
      
      :rtype: :ref:`wx.DateTime`
      
      
      
      
      
      
      
      **~~~**

      
      **Add** `(self, diff)`
      
      Adds the given time span to this object.                  
      
      
      :param `diff`: 
      :type `diff`: wx.TimeSpan
      
      
      
      
      :rtype: :ref:`wx.DateTime`
      
      
      
      
      
      
      
      **~~~**






   .. staticmethod:: 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. 

      This function should be used like this: 

      ::

                  dt = wx.DateTimeFromDMY(8, 5, 1977)
                  y = dt.GetYear()
                  epoch = (y > 0 and ["AD"] or ["BC"])[0]
                  print "The year is %d%s"%(wx.DateTime.ConvertYearToBC(y), epoch)

                 


      :param `year`: 
      :type `year`: int




      :rtype: `int`








   .. method:: DiffAsDateSpan(self, dt)

      Returns the difference between this object and `dt`  as a :ref:`wx.DateSpan`.                  

      This method allows to find the number of entire years, months, weeks and days between `dt`  and this date. 

                


      :param `dt`: 
      :type `dt`: wx.DateTime




      :rtype: :ref:`wx.DateSpan`







      .. versionadded:: 2.9.5 
     








   .. method:: Format(self, format=DefaultDateTimeFormat, tz=Local)

      This function does the same as the standard ``ANSI`` C  ``strftime(3)``   function (`http://www.cplusplus.com/reference/clibrary/ctime/strftime.html <http://www.cplusplus.com/reference/clibrary/ctime/strftime.html>`_).                  

      Please see its description for the meaning of `format`  parameter. 

      Notice that ``POSIX``  ``"%g"`` ,   ``"%G"`` ,   ``"%V"``   and   ``"%z"``   format specifiers are supported even if the standard library doesn't support them (e.g. ``MSVC``). 

      It also accepts a few Widgets-specific extensions: you can optionally specify the width of the field to follow using  ``printf(3)-like``   syntax and the format specification   ``"%l"``   can be used to get the number of milliseconds. 

                


      :param `format`: 
      :type `format`: string
      :param `tz`: 
      :type `tz`: wx.DateTime.TimeZone




      :rtype: `string`







      .. seealso:: :meth:`ParseFormat`     








   .. method:: FormatDate(self)

      Identical to calling :meth:`Format`   with  ``"%x"``   argument (which means "preferred date representation for the current locale").                   

      :rtype: `string`








   .. method:: FormatISOCombined(self, sep='T')

      Returns the combined date-time representation in the ``ISO`` 8601 format  ``"YYYY-MM-DDTHH:MM:SS"`` .                   

      The `sep`  parameter default value produces the result exactly corresponding to the ``ISO`` standard, but it can also be useful to use a space as separator if a more human-readable combined date-time representation is needed. 

                


      :param `sep`: 
      :type `sep`: int




      :rtype: `string`







      .. seealso:: :meth:`FormatISODate` , :meth:`FormatISOTime` , :meth:`ParseISOCombined`     








   .. method:: FormatISODate(self)

      This function returns the date representation in the ``ISO`` 8601 format  ``"YYYY-MM-DD"`` .                   

      :rtype: `string`








   .. method:: FormatISOTime(self)

      This function returns the time representation in the ``ISO`` 8601 format  ``"HH:MM:SS"`` .                   

      :rtype: `string`








   .. method:: FormatTime(self)

      Identical to calling :meth:`Format`   with  ``"%X"``   argument (which means "preferred time representation for the current locale").                   

      :rtype: `string`








   .. staticmethod:: FromDMY(day, month, year=Inv_Year, hour=0, minute=0, second=0, millisecond=0)

      Construct a :class:`DateTime` using the supplied parameters. 

      :rtype: :ref:`wx.DateTime`








   .. staticmethod:: FromHMS(hour, minute=0, second=0, millisecond=0)

      Construct a :class:`DateTime` equal to :meth:`Today` () with the time set to the supplied parameters. 

      :rtype: :ref:`wx.DateTime`








   .. staticmethod:: FromJDN(jdn)

      Construct a :class:`DateTime` from a Julian Day Number.

      By definition, the Julian Day Number, usually abbreviated as ``JDN``, of a particular instant is the fractional number of days since 12 hours Universal Coordinated Time (Greenwich mean noon) on January 1 of the year -4712 in the Julian proleptic calendar. 

      :rtype: :ref:`wx.DateTime`








   .. staticmethod:: FromTimeT(timet)

      Construct a :class:`DateTime` from a C ``time_t`` value, the number of seconds since the epoch. 

      :rtype: :ref:`wx.DateTime`








   .. method:: FromTimezone(self, 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. 

      Notice using :meth:`wx.DateTime.Local`   for `tz`  parameter doesn't really make sense and may result in unexpected results as it will return a different object when ``DST`` is in use and `noDST`  has its default value of ``False``. 

                


      :param `tz`: 
      :type `tz`: wx.DateTime.TimeZone
      :param `noDST`: 
      :type `noDST`: bool




      :rtype: :ref:`wx.DateTime`







      :returns: 

         The date adjusted by the different between the given and the local time zones.   








   .. staticmethod:: 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.                  

      :rtype: `tuple`







      :returns: 

         ( `am`, `pm` ) 








   .. method:: GetAsDOS(self)

      Returns the date and time in ``DOS`` format.                  

      :rtype: `int`








   .. staticmethod:: GetBeginDST(year=Inv_Year, country=Country_Default)

      Get the beginning of ``DST`` for the given country in the given year (current one by default).                  

      This function suffers from limitations described in the :ref:`DST overview <dst overview>`. 

                


      :param `year`: 
      :type `year`: int
      :param `country`: 
      :type `country`: wx.DateTime.Country




      :rtype: :ref:`wx.DateTime`







      .. seealso:: :meth:`GetEndDST`     








   .. method:: GetCentury(self, tz=Local)

      Returns the century of this date.                  


      :param `tz`: 
      :type `tz`: wx.DateTime.TimeZone




      :rtype: `int`








   .. staticmethod:: GetCountry()

      Returns the current default country.                  

      The default country is used for ``DST`` calculations, for example. 

                

      :rtype: :ref:`wx.DateTime.Country`







      .. seealso:: :meth:`SetCountry`     








   .. staticmethod:: GetCurrentMonth(cal=Gregorian)

      Get the current month in given calendar (only Gregorian is currently supported).                  


      :param `cal`: 
      :type `cal`: wx.DateTime.Calendar




      :rtype: :ref:`wx.DateTime.Month`








   .. staticmethod:: GetCurrentYear(cal=Gregorian)

      Get the current year in given calendar (only Gregorian is currently supported).                  


      :param `cal`: 
      :type `cal`: wx.DateTime.Calendar




      :rtype: `int`








   .. method:: GetDateOnly(self)

      Returns the object having the same date component as this one but time of 00:00:00.                  

                

      :rtype: :ref:`wx.DateTime`







      .. versionadded:: 2.8.2 
    







      .. seealso:: :meth:`ResetTime`     








   .. method:: GetDay(self, tz=Local)

      Returns the day in the given timezone (local one by default).                  


      :param `tz`: 
      :type `tz`: wx.DateTime.TimeZone




      :rtype: `intshort`








   .. method:: GetDayOfYear(self, tz=Local)

      Returns the day of the year (in ``1-366`` range) in the given timezone (local one by default).                  


      :param `tz`: 
      :type `tz`: wx.DateTime.TimeZone




      :rtype: `intshort`








   .. staticmethod:: GetEndDST(year=Inv_Year, country=Country_Default)

      Returns the end of ``DST`` for the given country in the given year (current one by default).                  

                


      :param `year`: 
      :type `year`: int
      :param `country`: 
      :type `country`: wx.DateTime.Country




      :rtype: :ref:`wx.DateTime`







      .. seealso:: :meth:`GetBeginDST`     








   .. staticmethod:: GetEnglishMonthName(month, flags=Name_Full)

      Return the standard English name of the given month.                  

      This function always returns "January" or "Jan" for January, use :meth:`GetMonthName`   to retrieve the name of the month in the users current locale. 




      :param `month`: One of :meth:`wx.DateTime.Jan` , ..., :meth:`wx.DateTime.Dec`   values.   
      :type `month`: DateTime.Month
      :param `flags`: Either Name_Full (default) or Name_Abbr.  
      :type `flags`: wx.DateTime.NameFlags








      :rtype: `string`



                  



      .. versionadded:: 2.9.0 
     







      .. seealso:: :meth:`GetEnglishWeekDayName`   








   .. staticmethod:: GetEnglishWeekDayName(weekday, flags=Name_Full)

      Return the standard English name of the given week day.                  

      This function always returns "Monday" or "Mon" for Monday, use :meth:`GetWeekDayName`   to retrieve the name of the month in the users current locale. 




      :param `weekday`: One of :meth:`wx.DateTime.Sun` , ..., :meth:`wx.DateTime.Sat`   values.   
      :type `weekday`: DateTime.WeekDay
      :param `flags`: Either Name_Full (default) or Name_Abbr.  
      :type `flags`: wx.DateTime.NameFlags








      :rtype: `string`



                  



      .. versionadded:: 2.9.0 
     







      .. seealso:: :meth:`GetEnglishMonthName`   








   .. method:: GetHour(self, tz=Local)

      Returns the hour in the given timezone (local one by default).                  


      :param `tz`: 
      :type `tz`: wx.DateTime.TimeZone




      :rtype: `intshort`








   .. method:: GetJDN(self)

      Synonym for :meth:`GetJulianDayNumber` .                  

      :rtype: `float`








   .. method:: GetJulianDayNumber(self)

      Returns the ``JDN`` corresponding to this date.                  

      Beware of rounding errors! 

                

      :rtype: `float`







      .. seealso:: :meth:`GetModifiedJulianDayNumber`     








   .. method:: GetLastMonthDay(self, month=Inv_Month, year=Inv_Year)

      Returns the copy of this object to which :meth:`SetToLastMonthDay`   was applied.                  


      :param `month`: 
      :type `month`: DateTime.Month
      :param `year`: 
      :type `year`: int




      :rtype: :ref:`wx.DateTime`








   .. method:: GetLastWeekDay(self, weekday, month=Inv_Month, year=Inv_Year)

      Returns the copy of this object to which :meth:`SetToLastWeekDay`   was applied.                  


      :param `weekday`: 
      :type `weekday`: DateTime.WeekDay
      :param `month`: 
      :type `month`: DateTime.Month
      :param `year`: 
      :type `year`: int




      :rtype: :ref:`wx.DateTime`








   .. method:: GetMJD(self)

      Synonym for :meth:`GetModifiedJulianDayNumber` .                  

      :rtype: `float`








   .. method:: GetMillisecond(self, tz=Local)

      Returns the milliseconds in the given timezone (local one by default).                  


      :param `tz`: 
      :type `tz`: wx.DateTime.TimeZone




      :rtype: `intshort`








   .. method:: GetMinute(self, tz=Local)

      Returns the minute in the given timezone (local one by default).                  


      :param `tz`: 
      :type `tz`: wx.DateTime.TimeZone




      :rtype: `intshort`








   .. method:: GetModifiedJulianDayNumber(self)

      Returns the `"Modified Julian Day Number"`  (``MJD``) which is, by definition, is 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 the noons like ``JDN``. The ``MJD`` 0 represents Nov 17, 1858.                  

      :rtype: `float`








   .. method:: GetMonth(self, tz=Local)

      Returns the month in the given timezone (local one by default).                  


      :param `tz`: 
      :type `tz`: wx.DateTime.TimeZone




      :rtype: :ref:`wx.DateTime.Month`








   .. staticmethod:: GetMonthName(month, flags=Name_Full)

      Gets the full (default) or abbreviated name of the given month.                  

      This function returns the name in the current locale, use :meth:`GetEnglishMonthName`   to get the untranslated name if necessary. 




      :param `month`: One of :meth:`wx.DateTime.Jan` , ..., :meth:`wx.DateTime.Dec`   values.   
      :type `month`: DateTime.Month
      :param `flags`: Either Name_Full (default) or Name_Abbr.  
      :type `flags`: wx.DateTime.NameFlags








      :rtype: `string`



                  



      .. seealso:: :meth:`GetWeekDayName`     








   .. method:: GetNextWeekDay(self, weekday)

      Returns the copy of this object to which :meth:`SetToNextWeekDay`   was applied.                  


      :param `weekday`: 
      :type `weekday`: DateTime.WeekDay




      :rtype: :ref:`wx.DateTime`








   .. staticmethod:: GetNumberOfDays(month, year=Inv_Year, cal=Gregorian)

      Returns the number of days in the given month of the given year.                  

      The only supported value for `cal`  currently is  ``Gregorian`` .                   


      :param `month`: 
      :type `month`: DateTime.Month
      :param `year`: 
      :type `year`: int
      :param `cal`: 
      :type `cal`: wx.DateTime.Calendar




      :rtype: `intshort`








   .. method:: GetPrevWeekDay(self, weekday)

      Returns the copy of this object to which :meth:`SetToPrevWeekDay`   was applied.                  


      :param `weekday`: 
      :type `weekday`: DateTime.WeekDay




      :rtype: :ref:`wx.DateTime`








   .. method:: GetRataDie(self)

      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.                  

      :rtype: `float`








   .. method:: GetSecond(self, tz=Local)

      Returns the seconds in the given timezone (local one by default).                  


      :param `tz`: 
      :type `tz`: wx.DateTime.TimeZone




      :rtype: `intshort`








   .. method:: GetTicks(self)

      Returns the number of seconds since Jan 1, 1970 ``UTC``.                  

      An assert failure will occur if the date is not in the range covered by  ``time_t``   type, use GetValue() if you work with dates outside of it.                   

      :rtype: `int`








   .. staticmethod:: GetTimeNow()

      Returns the current time.                  

      :rtype: `int`








   .. method:: GetTm(self, tz=Local)

      Returns broken down representation of the date and time.                  


      :param `tz`: 
      :type `tz`: wx.DateTime.TimeZone




      :rtype: :ref:`wx.DateTime.Tm`








   .. method:: GetWeekDay(self, *args, **kw)



      |overload| Overloaded Implementations:

      **~~~**

      
      **GetWeekDay** `(self, tz=Local)`
      
      Returns the week day in the given timezone (local one by default).                  
      
      
      :param `tz`: 
      :type `tz`: wx.DateTime.TimeZone
      
      
      
      
      :rtype: :ref:`wx.DateTime.WeekDay`
      
      
      
      
      
      
      
      **~~~**

      
      **GetWeekDay** `(self, weekday, n=1, month=Inv_Month, year=Inv_Year)`
      
      Returns the copy of this object to which :meth:`SetToWeekDay`   was applied.                  
      
      
      :param `weekday`: 
      :type `weekday`: DateTime.WeekDay
      :param `n`: 
      :type `n`: int
      :param `month`: 
      :type `month`: DateTime.Month
      :param `year`: 
      :type `year`: int
      
      
      
      
      :rtype: :ref:`wx.DateTime`
      
      
      
      
      
      
      
      **~~~**






   .. method:: GetWeekDayInSameWeek(self, weekday, flags=Monday_First)

      Returns the copy of this object to which :meth:`SetToWeekDayInSameWeek`   was applied.                  


      :param `weekday`: 
      :type `weekday`: DateTime.WeekDay
      :param `flags`: 
      :type `flags`: wx.DateTime.WeekFlags




      :rtype: :ref:`wx.DateTime`








   .. staticmethod:: GetWeekDayName(weekday, flags=Name_Full)

      Gets the full (default) or abbreviated name of the given week day.                  

      This function returns the name in the current locale, use :meth:`GetEnglishWeekDayName`   to get the untranslated name if necessary. 




      :param `weekday`: One of :meth:`wx.DateTime.Sun` , ..., :meth:`wx.DateTime.Sat`   values.   
      :type `weekday`: DateTime.WeekDay
      :param `flags`: Either Name_Full (default) or Name_Abbr.  
      :type `flags`: wx.DateTime.NameFlags








      :rtype: `string`



                  



      .. seealso:: :meth:`GetMonthName`     








   .. method:: GetWeekOfMonth(self, flags=Monday_First, tz=Local)

      Returns the ordinal number of the week in the month (in ``1-5`` range).                  

      As :meth:`GetWeekOfYear` , this function supports both conventions for the week start.                  


      :param `flags`: 
      :type `flags`: wx.DateTime.WeekFlags
      :param `tz`: 
      :type `tz`: wx.DateTime.TimeZone




      :rtype: `intshort`








   .. method:: GetWeekOfYear(self, flags=Monday_First, tz=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 week start convention specified by the `flags`  argument but its results for  ``Sunday_First``   are not well-defined as the ``ISO`` definition quoted above applies to the weeks starting on Monday only.                   


      :param `flags`: 
      :type `flags`: wx.DateTime.WeekFlags
      :param `tz`: 
      :type `tz`: wx.DateTime.TimeZone




      :rtype: `intshort`








   .. method:: GetYear(self, tz=Local)

      Returns the year in the given timezone (local one by default).                  


      :param `tz`: 
      :type `tz`: wx.DateTime.TimeZone




      :rtype: `int`








   .. method:: GetYearDay(self, yday)

      Returns the copy of this object to which :meth:`SetToYearDay`   was applied.                  


      :param `yday`: 
      :type `yday`: int




      :rtype: :ref:`wx.DateTime`








   .. method:: IsBetween(self, t1, t2)

      Returns ``True`` if :meth:`IsStrictlyBetween`   is ``True`` or if the date is equal to one of the limit values.                  

                


      :param `t1`: 
      :type `t1`: wx.DateTime
      :param `t2`: 
      :type `t2`: wx.DateTime




      :rtype: `bool`







      .. seealso:: :meth:`IsStrictlyBetween`     








   .. method:: IsDST(self, country=Country_Default)

      Returns ``True`` if the ``DST`` is applied for this date in the given country.                  

                


      :param `country`: 
      :type `country`: wx.DateTime.Country




      :rtype: `int`







      .. seealso:: :meth:`GetBeginDST` , :meth:`GetEndDST`     








   .. staticmethod:: IsDSTApplicable(year=Inv_Year, country=Country_Default)

      Returns ``True`` if ``DST`` was used in the given year (the current one by default) in the given country.                  


      :param `year`: 
      :type `year`: int
      :param `country`: 
      :type `country`: wx.DateTime.Country




      :rtype: `bool`








   .. method:: IsEarlierThan(self, datetime)

      Returns ``True`` if this date precedes the given one.                  


      :param `datetime`: 
      :type `datetime`: wx.DateTime




      :rtype: `bool`








   .. method:: IsEqualTo(self, datetime)

      Returns ``True`` if the two dates are strictly identical.                  


      :param `datetime`: 
      :type `datetime`: wx.DateTime




      :rtype: `bool`








   .. method:: IsEqualUpTo(self, 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.                  


      :param `dt`: 
      :type `dt`: wx.DateTime
      :param `ts`: 
      :type `ts`: wx.TimeSpan




      :rtype: `bool`








   .. method:: IsLaterThan(self, datetime)

      Returns ``True`` if this date is later than the given one.                  


      :param `datetime`: 
      :type `datetime`: wx.DateTime




      :rtype: `bool`








   .. staticmethod:: IsLeapYear(year=Inv_Year, cal=Gregorian)

      Returns ``True`` if the `year`  is a leap one in the specified calendar.                  

      This functions supports Gregorian and Julian calendars.                  


      :param `year`: 
      :type `year`: int
      :param `cal`: 
      :type `cal`: wx.DateTime.Calendar




      :rtype: `bool`








   .. method:: IsSameDate(self, dt)

      Returns ``True`` if the date is the same without comparing the time parts.                  


      :param `dt`: 
      :type `dt`: wx.DateTime




      :rtype: `bool`








   .. method:: IsSameTime(self, dt)

      Returns ``True`` if the time is the same (although dates may differ).                  


      :param `dt`: 
      :type `dt`: wx.DateTime




      :rtype: `bool`








   .. method:: IsStrictlyBetween(self, t1, t2)

      Returns ``True`` if this date lies strictly between the two given dates.                  

                


      :param `t1`: 
      :type `t1`: wx.DateTime
      :param `t2`: 
      :type `t2`: wx.DateTime




      :rtype: `bool`







      .. seealso:: :meth:`IsBetween`     








   .. method:: IsValid(self)

      Returns ``True`` if the object represents a valid time moment.                  

      :rtype: `bool`








   .. staticmethod:: IsWestEuropeanCountry(country=Country_Default)

      This function returns ``True`` if the specified (or default) country is one of Western European ones.                  

      It is used internally by :ref:`wx.DateTime`  to determine the ``DST`` convention and date and time formatting rules.                  


      :param `country`: 
      :type `country`: wx.DateTime.Country




      :rtype: `bool`








   .. method:: IsWorkDay(self, country=Country_Default)

      Returns ``True`` is this day is not a holiday in the given country.                  


      :param `country`: 
      :type `country`: wx.DateTime.Country




      :rtype: `bool`








   .. method:: MakeFromTimezone(self, tz, noDST=False)

      Same as :meth:`FromTimezone`   but modifies the object in place.                  


      :param `tz`: 
      :type `tz`: wx.DateTime.TimeZone
      :param `noDST`: 
      :type `noDST`: bool




      :rtype: :ref:`wx.DateTime`








   .. method:: MakeTimezone(self, tz, 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.                  


      :param `tz`: 
      :type `tz`: wx.DateTime.TimeZone
      :param `noDST`: 
      :type `noDST`: bool




      :rtype: :ref:`wx.DateTime`








   .. method:: MakeUTC(self, noDST=False)

      This is the same as calling :meth:`MakeTimezone`   with the argument  ``GMT0`` .                   


      :param `noDST`: 
      :type `noDST`: bool




      :rtype: :ref:`wx.DateTime`








   .. staticmethod:: Now()

      Returns the object corresponding to the current time.                  

      Example: 

      ::

                  now = wx.DateTime.Now()
                  print "Current time in Paris:\t%s\n"%(now.Format("%c", wx.DateTime.CET))



                

      :rtype: :ref:`wx.DateTime`







      .. note:: 

         This function is accurate up to seconds. :meth:`UNow`   can be used if better precision is required.  







      .. seealso:: :meth:`Today`     








   .. method:: ParseDate(self, date)

      This function is like :meth:`ParseDateTime` , but it only allows the date to be specified.                  

      It is thus less flexible then :meth:`ParseDateTime` , but also has less chances to misinterpret the user input. 

      See :meth:`ParseFormat`   for the description of function parameters and return value. 

                


      :param `date`: 
      :type `date`: string




      :rtype: `int`







      .. seealso:: :meth:`Format`     








   .. method:: ParseDateTime(self, 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 :meth:`ParseRfc822Date` , it will accept anything that may be accepted and will only reject strings which cannot be parsed in any way at all. Notice that the function will fail if either date or time part is present but not both, use :meth:`ParseDate`   or :meth:`ParseTime`   to parse strings containing just the date or time component. 

      See :meth:`ParseFormat`   for the description of function parameters and return value.                  


      :param `datetime`: 
      :type `datetime`: string




      :rtype: `int`








   .. method:: ParseFormat(self, *args, **kw)



      |overload| Overloaded Implementations:

      **~~~**

      
      **ParseFormat** `(self, date, format, dateDef)`
      
      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 day of the month), the month and the year are taken from  `dateDef`. If it is not specified, :meth:`Today`   is used as the default date. 
      
      Example of using this function: ::
      
                  dt = wx.DateTime() # Uninitialized datetime
                  bDate = "25/12/2012"
      
                  if dt.ParseFormat(bDate, "%d-%m-%Y") == -1:
                      # This datetime format is wrong on purpose
                      print "Wrong format"
      
                  elif dt.ParseFormat(bDate, "%d/%m/%Y") >= 0:
                      # This is correct
                      print "Format OK!", dt
      
      
      
      
      
      
      :param `date`: The string to be parsed.   
      :type `date`: string
      :param `format`: strptime()-like format string.   
      :type `format`: string
      :param `dateDef`: Used to fill in the date components not specified in the  `date`  string.   
      :type `dateDef`: wx.DateTime
      
      
      
      
      
      
      
      
      
      
      
      
      :rtype: `int`
      
      
      
                        
      
      
      
      :returns: 
      
         -1 if the parse failed, the number of characters parsed otherwise.  
      
      
      
      
      
      
      
      .. seealso:: :meth:`Format`     
      
      
      
      
      
      
      
      **~~~**

      
      **ParseFormat** `(self, date, format)`
      
      This version of the :meth:`ParseFormat` method works the same, but with missing values filled in from :meth:`Today`. 
      
      
      :param `date`: 
      :type `date`: string
      :param `format`: 
      :type `format`: string
      
      
      
      
      :rtype: `int`
      
      
      
      
      
      
      
      **~~~**

      
      **ParseFormat** `(self, date)`
      
      This version uses "%c" as the format code, which is the same default used by :meth:`Format`. 
      
      
      :param `date`: 
      :type `date`: string
      
      
      
      
      :rtype: `int`
      
      
      
      
      
      
      
      **~~~**






   .. method:: ParseISOCombined(self, date, sep='T')

      This function parses the string containing the date and time in ``ISO`` 8601 combined format  ``"YYYY-MM-DDTHH:MM:SS"`` .                   

      The separator between the date and time parts must be equal to `sep`  for the function to succeed. 

                


      :param `date`: 
      :type `date`: string
      :param `sep`: 
      :type `sep`: int




      :rtype: `bool`







      :returns: 

         ``True`` if the entire string was parsed successfully, ``False`` otherwise.   








   .. method:: ParseISODate(self, date)

      This function parses the date in ``ISO`` 8601 format  ``"YYYY-MM-DD"`` .                   

                


      :param `date`: 
      :type `date`: string




      :rtype: `bool`







      :returns: 

         ``True`` if the entire string was parsed successfully, ``False`` otherwise.   








   .. method:: ParseISOTime(self, date)

      This function parses the time in ``ISO`` 8601 format  ``"HH:MM:SS"`` .                   

                


      :param `date`: 
      :type `date`: string




      :rtype: `bool`







      :returns: 

         ``True`` if the entire string was parsed successfully, ``False`` otherwise.   








   .. method:: ParseRfc822Date(self, 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  ``NUL``   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 :meth:`ParseDateTime`   or :meth:`ParseDate`   instead. 

      See :meth:`ParseFormat`   for the description of function parameters and return value.                  


      :param `date`: 
      :type `date`: string




      :rtype: `int`








   .. method:: ParseTime(self, time)

      This functions is like :meth:`ParseDateTime` , but only allows the time to be specified in the input string.                  

      See :meth:`ParseFormat`   for the description of function parameters and return value.                  


      :param `time`: 
      :type `time`: string




      :rtype: `int`








   .. method:: ResetTime(self)

      Reset time to midnight (00:00:00) without changing the date.                  

      :rtype: :ref:`wx.DateTime`








   .. method:: Set(self, day, month, year=Inv_Year, hour=0, minute=0, second=0, millisec=0)

      Sets the date and time from the parameters.                  

      If the function parameters are invalid, e.g. `month`  is February and `day`  is 30, the object is left in an invalid state, i.e. :meth:`IsValid`   method will return ``False``. 

      If the specified time moment is invalid due to ``DST``, i.e. it falls into the "missing" hour on the date on which the ``DST`` starts, a valid :ref:`wx.DateTime`  object is still constructed but its hour component is moved forward to ensure that it corresponds to a valid moment in the local time zone. For example, in the ``CET`` time zone the ``DST`` started on 2013-03-31T02:00:00 in 2013 and so setting the object to 2:30 at this date actually sets the hour to 3, and not 2.                  


      :param `day`: 
      :type `day`: int
      :param `month`: 
      :type `month`: DateTime.Month
      :param `year`: 
      :type `year`: int
      :param `hour`: 
      :type `hour`: int
      :param `minute`: 
      :type `minute`: int
      :param `second`: 
      :type `second`: int
      :param `millisec`: 
      :type `millisec`: int




      :rtype: :ref:`wx.DateTime`








   .. method:: SetHMS(self, hour, minute=0, second=0, millisec=0)

      Sets the date to be equal to :meth:`Today`   and the time from supplied parameters.                  

      See the full :meth:`Set`   overload for the remarks about ``DST``.                  


      :param `hour`: 
      :type `hour`: int
      :param `minute`: 
      :type `minute`: int
      :param `second`: 
      :type `second`: int
      :param `millisec`: 
      :type `millisec`: int




      :rtype: :ref:`wx.DateTime`








   .. method:: SetJDN(self, jdn)

      Sets the date from the so-called Julian Day Number.                  

      By definition, the Julian Day Number, usually abbreviated as ``JDN``, of a particular instant is the fractional number of days since 12 hours Universal Coordinated Time (Greenwich mean noon) on January 1 of the year -4712 in the Julian proleptic calendar.                  


      :param `jdn`: 
      :type `jdn`: float




      :rtype: :ref:`wx.DateTime`








   .. method:: SetTimeT(self, timet)

      Constructs the object from `timet`  value holding the number of seconds since Jan 1, 1970 ``UTC``.                  

      If `timet`  is invalid, i.e.::

          -1

      :ref:`wx.DateTime`  becomes invalid too, i.e. its :meth:`IsValid`   will return ``False``.                  


      :param `timet`: 
      :type `timet`: int




      :rtype: :ref:`wx.DateTime`








   .. method:: SetTm(self, tm)

      Sets the date and time from the broken down representation in the  ` :meth:`wx.DateTime.Tm`  `   structure.                  


      :param `tm`: 
      :type `tm`: wx.DateTime.Tm




      :rtype: :ref:`wx.DateTime`








   .. staticmethod:: SetCountry(country)

      Sets the country to use by default.                  

      This setting influences the ``DST`` calculations, date formatting and other things. 

                


      :param `country`: 
      :type `country`: wx.DateTime.Country






      .. seealso:: :meth:`GetCountry`     








   .. method:: SetDay(self, day)

      Sets the day without changing other date components.                  


      :param `day`: 
      :type `day`: int




      :rtype: :ref:`wx.DateTime`








   .. method:: SetFromDOS(self, ddt)

      Sets the date from the date and time in ``DOS`` format.                  


      :param `ddt`: 
      :type `ddt`: long




      :rtype: :ref:`wx.DateTime`








   .. method:: SetHour(self, hour)

      Sets the hour without changing other date components.                  


      :param `hour`: 
      :type `hour`: int




      :rtype: :ref:`wx.DateTime`








   .. method:: SetMillisecond(self, millisecond)

      Sets the millisecond without changing other date components.                  


      :param `millisecond`: 
      :type `millisecond`: int




      :rtype: :ref:`wx.DateTime`








   .. method:: SetMinute(self, minute)

      Sets the minute without changing other date components.                  


      :param `minute`: 
      :type `minute`: int




      :rtype: :ref:`wx.DateTime`








   .. method:: SetMonth(self, month)

      Sets the month without changing other date components.                  


      :param `month`: 
      :type `month`: DateTime.Month




      :rtype: :ref:`wx.DateTime`








   .. method:: SetSecond(self, second)

      Sets the second without changing other date components.                  


      :param `second`: 
      :type `second`: int




      :rtype: :ref:`wx.DateTime`








   .. method:: SetToCurrent(self)

      Sets the date and time of to the current values.                  

      Same as assigning the result of :ref:`wx.Now`  to this object.                  

      :rtype: :ref:`wx.DateTime`








   .. method:: SetToLastMonthDay(self, month=Inv_Month, year=Inv_Year)

      Sets the date to the last day in the specified month (the current one by default).                  

                


      :param `month`: 
      :type `month`: DateTime.Month
      :param `year`: 
      :type `year`: int




      :rtype: :ref:`wx.DateTime`







      :returns: 

         The reference to the modified object itself.   








   .. method:: SetToLastWeekDay(self, weekday, month=Inv_Month, year=Inv_Year)

      The effect of calling this function is the same as of calling  ``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``.                  


      :param `weekday`: 
      :type `weekday`: DateTime.WeekDay
      :param `month`: 
      :type `month`: DateTime.Month
      :param `year`: 
      :type `year`: int




      :rtype: `bool`








   .. method:: SetToNextWeekDay(self, weekday)

      Sets the date so that it will be the first `weekday`  following the current date.                  

                


      :param `weekday`: 
      :type `weekday`: DateTime.WeekDay




      :rtype: :ref:`wx.DateTime`







      :returns: 

         The reference to the modified object itself.   








   .. method:: SetToPrevWeekDay(self, weekday)

      Sets the date so that it will be the last `weekday`  before the current date.                  

                


      :param `weekday`: 
      :type `weekday`: DateTime.WeekDay




      :rtype: :ref:`wx.DateTime`







      :returns: 

         The reference to the modified object itself.   








   .. method:: SetToWeekDay(self, weekday, n=1, month=Inv_Month, year=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, `DateTime.Wed)` will set the date to the second Wednesday in the current month and SetToWeekDay(-1, :meth:`wx.DateTime.Sun` ) will set the date to the last Sunday in the current month. 

                


      :param `weekday`: 
      :type `weekday`: DateTime.WeekDay
      :param `n`: 
      :type `n`: int
      :param `month`: 
      :type `month`: DateTime.Month
      :param `year`: 
      :type `year`: int




      :rtype: `bool`







      :returns: 

         ``True`` if the date was modified successfully, ``False`` otherwise meaning that the specified date doesn't exist.   








   .. method:: SetToWeekDayInSameWeek(self, weekday, flags=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.                  

                


      :param `weekday`: 
      :type `weekday`: DateTime.WeekDay
      :param `flags`: 
      :type `flags`: wx.DateTime.WeekFlags




      :rtype: :ref:`wx.DateTime`







      :returns: 

         The reference to the modified object itself.   








   .. staticmethod:: SetToWeekOfYear(year, numWeek, weekday=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``. 

      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 :meth:`GetWeekOfYear`   for the explanation of how the year weeks are counted.                  


      :param `year`: 
      :type `year`: int
      :param `numWeek`: 
      :type `numWeek`: int
      :param `weekday`: 
      :type `weekday`: DateTime.WeekDay




      :rtype: :ref:`wx.DateTime`








   .. method:: SetToYearDay(self, 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. 

                


      :param `yday`: 
      :type `yday`: int




      :rtype: :ref:`wx.DateTime`







      :returns: 

         The reference to the modified object itself.   








   .. method:: SetYear(self, year)

      Sets the year without changing other date components.                  


      :param `year`: 
      :type `year`: int




      :rtype: :ref:`wx.DateTime`








   .. method:: Subtract(self, *args, **kw)



      |overload| Overloaded Implementations:

      **~~~**

      
      **Subtract** `(self, diff)`
      
      Subtracts the given time span from this object.                  
      
      
      :param `diff`: 
      :type `diff`: wx.TimeSpan
      
      
      
      
      :rtype: :ref:`wx.DateTime`
      
      
      
      
      
      
      
      **~~~**

      
      **Subtract** `(self, diff)`
      
      Subtracts the given date span from this object.                  
      
      
      :param `diff`: 
      :type `diff`: wx.DateSpan
      
      
      
      
      :rtype: :ref:`wx.DateTime`
      
      
      
      
      
      
      
      **~~~**

      
      **Subtract** `(self, dt)`
      
      Subtracts another date from this one and returns the difference between them as a :ref:`wx.TimeSpan`.                  
      
      
      :param `dt`: 
      :type `dt`: wx.DateTime
      
      
      
      
      :rtype: :ref:`wx.TimeSpan`
      
      
      
      
      
      
      
      **~~~**






   .. method:: ToTimezone(self, tz, noDST=False)

      Transform the date to the given time zone.                  

      If `noDST`  is ``True``, no ``DST`` adjustments will be made. 

      Notice that, as with :meth:`FromTimezone` , using :meth:`wx.DateTime.Local`   as `tz`  doesn't really make sense and may return a different object when ``DST`` is in effect and `noDST`  is ``False``. 

                


      :param `tz`: 
      :type `tz`: wx.DateTime.TimeZone
      :param `noDST`: 
      :type `noDST`: bool




      :rtype: :ref:`wx.DateTime`







      :returns: 

         The date adjusted by the different between the local and the given time zones.   








   .. method:: ToUTC(self, noDST=False)

      This is the same as calling :meth:`ToTimezone`   with the argument  ``GMT0`` .                   


      :param `noDST`: 
      :type `noDST`: bool




      :rtype: :ref:`wx.DateTime`








   .. staticmethod:: Today()

      Returns the object corresponding to the midnight of the current day (i.e. the same as :ref:`wx.Now`, but the time part is set to 0).                  

                

      :rtype: :ref:`wx.DateTime`







      .. seealso:: :ref:`wx.Now`    








   .. staticmethod:: UNow()

      Returns the object corresponding to the current ``UTC`` time including the milliseconds.                  

      Notice that unlike :ref:`wx.Now`, this method creates a :ref:`wx.DateTime`  object corresponding to ``UTC``, not local, time. 

                

      :rtype: :ref:`wx.DateTime`







      .. seealso:: :ref:`wx.Now`, :meth:`GetUTCTimeMillis`     








   .. method:: __repr__(self)




   .. method:: __str__(self)




   .. attribute:: DayOfYear

      See :meth:`~wx.DateTime.GetDayOfYear`


   .. attribute:: JDN

      See :meth:`~wx.DateTime.GetJDN` and :meth:`~wx.DateTime.SetJDN`


   .. attribute:: JulianDayNumber

      See :meth:`~wx.DateTime.GetJulianDayNumber`


   .. attribute:: LastMonthDay

      See :meth:`~wx.DateTime.GetLastMonthDay`


   .. attribute:: MJD

      See :meth:`~wx.DateTime.GetMJD`


   .. attribute:: ModifiedJulianDayNumber

      See :meth:`~wx.DateTime.GetModifiedJulianDayNumber`


   .. attribute:: RataDie

      See :meth:`~wx.DateTime.GetRataDie`


   .. attribute:: Ticks

      See :meth:`~wx.DateTime.GetTicks`


   .. attribute:: WeekOfMonth

      See :meth:`~wx.DateTime.GetWeekOfMonth`


   .. attribute:: WeekOfYear

      See :meth:`~wx.DateTime.GetWeekOfYear`


   .. attribute:: day

      See :meth:`~wx.DateTime.GetDay` and :meth:`~wx.DateTime.SetDay`


   .. attribute:: hour

      See :meth:`~wx.DateTime.GetHour` and :meth:`~wx.DateTime.SetHour`


   .. attribute:: millisecond

      See :meth:`~wx.DateTime.GetMillisecond` and :meth:`~wx.DateTime.SetMillisecond`


   .. attribute:: minute

      See :meth:`~wx.DateTime.GetMinute` and :meth:`~wx.DateTime.SetMinute`


   .. attribute:: month

      See :meth:`~wx.DateTime.GetMonth` and :meth:`~wx.DateTime.SetMonth`


   .. attribute:: second

      See :meth:`~wx.DateTime.GetSecond` and :meth:`~wx.DateTime.SetSecond`


   .. attribute:: year

      See :meth:`~wx.DateTime.GetYear` and :meth:`~wx.DateTime.SetYear`


.. toctree::
   :maxdepth: 1
   :hidden:

   wx.DateTime.Calendar.enumeration
   wx.DateTime.Country.enumeration
   wx.DateTime.Month.enumeration
   wx.DateTime.NameFlags.enumeration
   wx.DateTime.TZ.enumeration
   wx.DateTime.WeekDay.enumeration
   wx.DateTime.WeekFlags.enumeration
   wx.DateTime.Year.enumeration
