Skip to main content

A python-module to parse strings to time-, date-, datetime- or timedelta-objects.

Project description

Parse strings to objects of the datetime-module.

This module intends to make string-parsing to objects of the datetime-module as easy as possible while allowing a fine configuration about which kind of formats are supported.

Latest Version

The latest version of this project can be found at : http://github.com/thomst/timeparser.

Installation

  • Option 1 : Install via pip

    pip install timeparser
  • Option 2 : If you have downloaded the source

    python setup.py install

Dokumentaion:

Please visit the documentation on readthedocs.org: https://timeparser.readthedocs.org/en/latest/index.html

Usage

How to use?

>>> import timeparser
>>>
>>> timeparser.parsedate('24.4.13')
datetime.date(2013, 4, 24)
>>>
>>> timeparser.parsedate('24 Apr 2013')
datetime.date(2013, 4, 24)
>>>
>>> timeparser.parsetime('234405')
datetime.time(23, 44, 5)
>>>
>>> timeparser.TimeFormats.config(allow_no_sep=False)
>>> timeparser.parsetime('234405')
ValueError: couldn't parse 234405 as time
>>>
>>> timeparser.parsedatetime('24-04-13_23:44:05')
datetime.datetime(2013, 4, 24, 23, 44, 5)

Changes in v0.6

Removed deprecated stuff. Also improved the support for common used formats like dates ending with a dot (4.6.) or times ending on ‘h’ (22:30h).

Reporting Bugs

Please report bugs at github issue tracker: https://github.com/thomst/timeparser/issues

Author

thomst <thomaslfuss@gmx.de> Thomas Leichtfuß

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

timeparser-0.7.0.tar.gz (9.3 kB view details)

Uploaded Source

File details

Details for the file timeparser-0.7.0.tar.gz.

File metadata

  • Download URL: timeparser-0.7.0.tar.gz
  • Upload date:
  • Size: 9.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for timeparser-0.7.0.tar.gz
Algorithm Hash digest
SHA256 3a32cdb8de97f88c8e0babc081dd4293d2271b058b09a78e23bb475a85bf999f
MD5 bfebfd89f8f4fc4528c47ebfabf29632
BLAKE2b-256 0bf7639d7028ed23c1be3eeaf2f78c61b0b97243044efe53b0ca955120f73dae

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page