Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/alexprengere/fuzzydates

Fuzzy interpretation of dates.
https://github.com/alexprengere/fuzzydates

Last synced: about 1 month ago
JSON representation

Fuzzy interpretation of dates.

Awesome Lists containing this project

README

        

==========
FuzzyDates
==========

Fuzzy datetime reading.

Examples
--------

Import the main function:

.. code-block:: python

>>> from fuzzy_dates import load_date

Examples of fuzzy reading:

.. code-block:: python

>>> load_date('-0600', '[-+]%H%M')
datetime.datetime(1900, 1, 1, 6, 0)
>>> load_date('2010/01:02', '%Y[/:]%M[/:]%d')
datetime.datetime(2010, 1, 2, 0, 1)
>>> load_date('2010/01:02', '%Y[/:]%M/%d')
Traceback (most recent call last):
ValueError: Could not match regexp

Examples of fuzzy reading for timedelta:

.. code-block:: python

>>> load_date('-0600', '[-+]%H%M', delta=True)
datetime.timedelta(0, 21600)