This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description


  • Python 2.7
  • Python 3.3 or later


$ pip install typedate


you can use as follows:

#!/usr/bin/env python
from typedate import TypeDate, TypeDelta, TypeZone

if __name__ == '__main__':
    import argparse
    parser = argparse.ArgumentParser()

    # datetime parsing
    parser.add_argument("--datetime1", type=TypeDate('%Y%m%d'))
    parser.add_argument("--datetime2", type=TypeDate(timezone='Asia/Tokyo'))
    parser.add_argument("--datetime3", type=TypeDate(timezone='+09:00'))
    parser.add_argument("--datetime4", type=TypeDate(timedelta='1years -2months 3days 4hours 5minute 6seconds'))

    # timezone parsing
    parser.add_argument("--timezone1", type=TypeZone())
    parser.add_argument("--timezone2", type=TypeZone())

    # timedelta parsing
    ## if python-dateutil installed, used automatically dateutil.relativedelta.relativedelta else datetime.timedelta.
    parser.add_argument("--defaultdelta", type=TypeDelta())

    ## it can be specified by cls argument.
    from datetime import timedelta
    from dateutil.relativedelta import relativedelta
    parser.add_argument("--timedelta", type=TypeDelta(cls=timedelta))
    parser.add_argument("--relativedelta", type=TypeDelta(cls=relativedelta))

    args = parser.parse_args()
    print('datetime1:\t', args.datetime1, type(args.datetime1))
    print('datetime2:\t', args.datetime2, type(args.datetime2))
    print('datetime3:\t', args.datetime3, type(args.datetime3))
    print('datetime4:\t', args.datetime4, type(args.datetime4))

    print('timezone1:\t', args.timezone1, type(args.timezone1))
    print('timezone2:\t', args.timezone2, type(args.timezone2))

    print('defaultdelta:\t', args.defaultdelta, type(args.defaultdelta))
    print('timedelta:\t', args.timedelta, type(args.timedelta))
    print('relativedelta:\t', args.relativedelta, type(args.relativedelta))


$ python \
  --datetime1='19880522' \
  --datetime2='2016-01-01' \
  --datetime3='2016/01/01' \
  --datetime4='01/01 00:00 2016' \
  --timezone1='-0500' \
  --timezone2='Asia/Tokyo'  \
  --defaultdelta='1years -2months 3days 4hours 5minutes 6seconds' \
  --timedelta='3days 4hours 5minutes 6seconds' \
  --relativedelta='1years -2months 3days 4hours 5minutes 6seconds'

datetime1:       1988-05-22 00:00:00 <class 'datetime.datetime'>
datetime2:       2016-01-01 00:00:00+09:00 <class 'datetime.datetime'>
datetime3:       2016-01-01 00:00:00+09:00 <class 'datetime.datetime'>
datetime4:       2016-11-04 04:05:06 <class 'datetime.datetime'>
timezone1:       -05:00 <class ''>
timezone2:       Asia/Tokyo <class 'pytz.tzfile.Asia/Tokyo'>
defaultdelta:    relativedelta(years=+1, months=-2, days=+3, hours=+4, minutes=+5, seconds=+6) <class 'dateutil.relativedelta.relativedelta'>
timedelta:       3 days, 4:05:06 <class 'datetime.timedelta'>
relativedelta:   relativedelta(years=+1, months=-2, days=+3, hours=+4, minutes=+5, seconds=+6) <class 'dateutil.relativedelta.relativedelta'>



  • first release
Release History

Release History


This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
typedate-1.0.0.tar.gz (3.9 kB) Copy SHA256 Checksum SHA256 Source May 5, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting