skip to navigation
skip to content

parsedatetime 2.1

Parse human-readable date/time text.


Parse human-readable date/time strings.

Python 2.7 or greater is required for parsedatetime version 1.0 or greater.


You can install parsedatetime using:

pip install parsedatetime

Running Tests

From the source directory:

make test

To run tests on several python versions, type tox:

$ tox
[... tox creates a virtualenv for every python version and runs tests inside of each]
py27: commands succeeded
py35: commands succeeded

This assumes that you have python2.7, python3.5, etc in PATH.

Using parsedatetime

An example of how to use parsedatetime:

import parsedatetime

cal = parsedatetime.Calendar()


To get it to a Python datetime object:

from datetime import datetime
from time import mktime

time_struct, parse_status = cal.parse("tomorrow")

Parse datetime with timezone support (using pytz package):

import parsedatetime
import pytz
from pytz import timezone

cal = parsedatetime.Calendar()

datetime_obj, _ = cal.parseDT(datetimeString="tomorrow", tzinfo=timezone("US/Pacific"))

More detailed examples can be found in the examples directory.


The generated documentation is included by default in the docs directory and can also be viewed online at

The docs can be generated by running:

make docs


The Calendar class has a member property named ptc which is created during the class init method to be an instance of parsedatetime_consts.CalendarConstants().


The code in parsedatetime has been implemented over the years in many different languages (C, Clipper, Delphi) as part of different custom/proprietary systems I’ve worked on. Sadly the previous code is not “open” in any sense of that word.

When I went to work for Open Source Applications Foundation and realized that the Chandler project could benefit from my experience with parsing of date/time text I decided to start from scratch and implement the code using Python and make it truly open.

After working on the initial concept and creating something that could be shown to the Chandler folks the code has now evolved to it’s current state with the help the Chandler folks, most especially Darshana.

File Type Py Version Uploaded on Size
parsedatetime-2.1-py2-none-any.whl (md5) Python Wheel 2.6 2016-03-02 36KB
parsedatetime-2.1.tar.gz (md5) Source 2016-03-02 54KB