Website hosting service by Active-Venture.com
  

 Back to Index

6.9 datetime -- Basic date and time types

New in version 2.3.

The datetime module supplies classes for manipulating dates and times in both simple and complex ways. While date and time arithmetic is supported, the focus of the implementation is on efficient member extraction for output formatting and manipulation.

There are two kinds of date and time objects: ``naive'' and ``aware''. This distinction refers to whether the object has any notion of time zone, daylight saving time, or other kind of algorithmic or political time adjustment. Whether a naive datetime object represents Coordinated Universal Time (UTC), local time, or time in some other timezone is purely up to the program, just like it's up to the program whether a particular number represents meters, miles, or mass. Naive datetime objects are easy to understand and to work with, at the cost of ignoring some aspects of reality.

For applications requiring more, datetime and time objects have an optional time zone information member, tzinfo, that can contain an instance of a subclass of the abstract tzinfo class. These tzinfo objects capture information about the offset from UTC time, the time zone name, and whether Daylight Saving Time is in effect. Note that no concrete tzinfo classes are supplied by the datetime module. Supporting timezones at whatever level of detail is required is up to the application. The rules for time adjustment across the world are more political than rational, and there is no standard suitable for every application.

The datetime module exports the following constants:

 

MINYEAR
The smallest year number allowed in a date or datetime object. MINYEAR is 1.

 

MAXYEAR
The largest year number allowed in a date or datetime object. MAXYEAR is 9999.

 

See Also:

Module calendar:
General calendar related functions.
Module time:
Time access and conversions.

  

 

2002-2004 Active-Venture.com Webhosting Service

 

Disclaimer: This documentation is provided only for the benefits of our hosting customers.
For authoritative source of the documentation, please refer to http://python.org/doc/

 

Cheap domain registrar provides cheap domain registration, buy domain name and domain transfer from $5.95/year only   Cheap domain registration : Buy domain name and enjoy comprehensive free services