DateTime 3.0
DateTime is a module that provides a DateTime data type, as known from Zope 2. Unless you need to communicate with Zope 2 APIs, you're probably better off using Python's bult-in datetime module.
Function Timezones()
Returns the list of recognized timezone names:
>>> from DateTime import Timezones
>>> zones = set(Timezones())
Almost all of the standard pytz timezones are included, with the exception of some commonly-used but ambiguous abbreviations, where historical Zope usage conflicts with the name used by pytz:
>>> import pytz
>>> [x for x in pytz.all_timezones if x not in zones]
['CET', 'EET', 'EST', 'MET', 'MST', 'WET']
Class DateTime
DateTime objects represent instants in time and provide interfaces for controlling its representation without affecting the absolute value of the object.
DateTime objects may be created from a wide variety of string or numeric data, or may be computed from other DateTime objects. DateTimes support the ability to convert their representations to many major timezones, as well as the ablility to create a DateTime object in the context of a given timezone.
DateTime objects provide partial numerical behavior:
* Two date-time objects can be subtracted to obtain a time, in days between the two.
* A date-time object and a positive or negative number may be added to obtain a new date-time object that is the given number of days later than the input date-time object.
* A positive or negative number and a date-time object may be added to obtain a new date-time object that is the given number of days later than the input date-time object.
* A positive or negative number may be subtracted from a date-time object to obtain a new date-time object that is the given number of days earlier than the input date-time object.
DateTime objects may be converted to integer, long, or float numbers of days since January 1, 1901, using the standard int, long, and float functions (Compatibility Note: int, long and float return the number of days since 1901 in GMT rather than local machine timezone). DateTime objects also provide access to their value in a float format usable with the python time module, provided that the value of the object falls in the range of the epoch-based time module.
A DateTime object should be considered immutable; all conversion and numeric operations return a new DateTime object rather than modify the current object.
A DateTime object always maintains its value as an absolute UTC time, and is represented in the context of some timezone based on the arguments used to create the object. A DateTime object's methods return values based on the timezone context.
Note that in all cases the local machine timezone is used for representation if no timezone is specified.
Requirements:
Ссылка: http://pypi.pyt..s/source/D/DateTime/DateTime-3.0.zip#md5=d5d71043e3986ae95c17804a4fa60ba1
Новые:
|
Рейтинг за сегодня::
|
Похожие:
|