.. include:: headings.inc .. _date and time: =========================================== |phoenix_title| **Date and Time Overview** =========================================== Introduction ------------ wxPython provides a set of powerful classes to work with dates and times. Some of the supported features of :ref:`wx.DateTime` class are: * Wide range: the range of supported dates goes from about 4714 B.C. to some 480 million years in the future. * Precision: not using floating point calculations anywhere ensures that the date calculations don't suffer from rounding errors. * Many features: not only all usual calculations with dates are supported, but also more exotic week and year day calculations, work day testing, standard astronomical functions, conversion to and from strings in either strict or free format. * Efficiency: objects of :ref:`wx.DateTime` are small (8 bytes) and working with them is fast. All date/time classes at a glance --------------------------------- There are 3 main classes related to date and time: except :ref:`wx.DateTime` itself which represents an absolute moment in time, there are also two classes - :ref:`wx.TimeSpan` and :ref:`wx.DateSpan` - which represent the intervals of time. DateTime characteristics ------------------------ :ref:`wx.DateTime` stores the time as a signed number of milliseconds since the Epoch which is fixed, by convention, to Jan 1, 1970 - however this is not visible to the class users (in particular, dates prior to the Epoch are handled just as well (or as bad) as the dates after it). But it does mean that the best resolution which can be achieved with this class is 1 millisecond. The size of :ref:`wx.DateTime` object is 8 bytes because it is represented as a 64 bit integer. The resulting range of supported dates is thus approximately 580 million years, but due to the current limitations in the Gregorian calendar support, only dates from Nov 24, 4714BC are supported (this is subject to change if there is sufficient interest in doing it). Finally, the internal representation is time zone independent (always in GMT) and the time zones only come into play when a date is broken into year/month/day components. See more about timezones below (see :ref:`Time zone considerations