Thu, 20 May 2010
This document defines a date and time format for use in Internet protocols that is a profile of the ISO 8601 standard for representation of dates and times using the Gregorian calendar.
Our code provides
- a standard no-frills “UTC”
tzinfoclass and singleton instance
- a standard no-frills fixed-offset
- other utilities for helping write robust timezone-aware time manipulation code
These examples are taken from the doctests/docstrings in the module source itself. See the module documentation for many more informative examples.
Parsing a timestamp, with timezone support and timestamp equivalence:
>>> midnightUTC = parse_datetime("2008-08-24T00:00:00Z") >>> oneamBST = parse_datetime("2008-08-24T01:00:00+01:00") >>> midnightUTC == oneamBST True
Printing a timestamp:
>>> oneamBST.isoformat() '2008-08-24T01:00:00+01:00' >>> parse_datetime("2008-08-24T00:00:00.123Z").isoformat() '2008-08-24T00:00:00.123000+00:00'
Downloading the code
You can also install the module directly from github using
pip install -e git://github.com/tonyg/python-rfc3339.git#egg=rfc3339
On 20 May, 2010 at 10:20 am,wrote:
Have you considered TAI64?
On 21 May, 2010 at 2:45 am,wrote: