Welcome, guest | Sign In | My Account | Store | Cart

Notice! PyPM is being replaced with the ActiveState Platform, which enhances PyPM’s build and deploy capabilities. Create your free Platform account to download ActivePython or customize Python with the packages you require and get automatic updates.

pypm install iso8601

How to install iso8601

  1. Download and install ActivePython
  2. Open Command Prompt
  3. Type pypm install iso8601
 Python 2.7Python 3.2Python 3.3
Windows (32-bit)
0.1.8Never BuiltWhy not?
0.1.4 Available View build log
Windows (64-bit)
0.1.8Never BuiltWhy not?
0.1.4 Available View build log
Mac OS X (10.5+)
0.1.8Never BuiltWhy not?
0.1.4 Available View build log
Linux (32-bit)
0.1.8Never BuiltWhy not?
0.1.4 Available View build log
Linux (64-bit)
0.1.8 Available View build log
0.1.4 Available View build log
0.1.8 Available View build log
Lastest release
version 0.1.8 on Jan 9th, 2014

Simple module to parse ISO 8601 dates

This module parses the most common forms of ISO 8601 date strings (e.g. 2007-01-14T20:34:22+00:00) into datetime objects.

>>> import iso8601
>>> iso8601.parse_date("2007-01-25T12:00:00Z")
datetime.datetime(2007, 1, 25, 12, 0, tzinfo=<iso8601.iso8601.Utc ...>)

See the LICENSE file for the license this package is released under.

If you want more full featured parsing look at:

Parsed Formats

You can parse full date + times, or just the date. In both cases a datetime instance is returned but with missing times defaulting to 0, and missing days / months defaulting to 1.

  • YYYY-MM (defaults to 1 for the day)
  • hh:mm:ss.nn
  • hhmmss.nn
  • hh:mm (defaults to 0 for seconds)
  • hhmm (defaults to 0 for seconds)
  • hh (defaults to 0 for minutes and seconds)
Time Zones
  • Nothing uses the default timezone given (UTC).
  • Z (UTC)
  • +/-hh:mm
  • +/-hhmm
  • +/-hh

Where it Differs From ISO 8601

Known differences from the ISO 8601 spec:

  • You can use a " " (space) instead of T for separating date from time.
  • Days and months without a leading 0 (2 vs 02) will be parsed.
  • If time zone information is omitted the default time zone given is used (which in turn defaults to UTC). Use a default of None to yield naive datetime instances.



  1. pip install -r dev-requirements.txt
  2. tox

Note that you need all the pythons installed to perform a tox run (see below). Homebrew helps a lot on the mac, however you wind up having to add cellars to your PATH or symlinking the pythonX.Y executables.

Alternatively, to test only with your current python:

  1. pip install -r dev-requirements.txt
  2. py.test --verbose iso8601

Supported Python Versions

Tested against:

  • Python 2.6
  • Python 2.7
  • Python 3.2
  • Python 3.3
  • PyPy

Python 3.0 and 3.1 are untested but should work (tests didn't run under them when last tried).

Jython is untested but should work (tests failed to run).

Python 2.5 is not supported (too old for the tests for the most part). It could work with some small changes but I'm not supporting it.


  • The default_timezone argument wasn't being passed through correctly, UTC was being used in every case. Fixes issue 10.
  • Fixed the microsecond handling, the generated microsecond values were way too small. Fixes issue 9.
  • Adding ParseError to __all__ in iso8601 module, allows people to import it. Addresses issue 7.
  • Be a little more flexible when dealing with dates without leading zeroes. This violates the spec a little, but handles more dates as seen in the field. Addresses issue 6.
  • Allow date/time separators other than T.
  • When parsing dates without a timezone the specified default is used. If no default is specified then UTC is used. Addresses issue 4.

Subscribe to package updates

Last updated Jan 9th, 2014

Download Stats

Last month:4

What does the lock icon mean?

Builds marked with a lock icon are only available via PyPM to users with a current ActivePython Business Edition subscription.

Need custom builds or support?

ActivePython Enterprise Edition guarantees priority access to technical support, indemnification, expert consulting and quality-assured language builds.

Plan on re-distributing ActivePython?

Get re-distribution rights and eliminate legal risks with ActivePython OEM Edition.