PySO8601 aims to parse any ISO 8601 date, including Week dates, Ordinal dates, intervals and durations.
Project description
PySO8601 aims to be a better Python module to parse ISO 8601 dates. It is inspired by the iso8601 currently available in the pypi repository, however this module is designed to accept any valid ISO8601 formatted string:
Date including Week Dates (eg. 2011-W12-6) and Ordinal Dates (eg. 2012-003)
Time including Time zone designations
Truncated representations (YYYYMM, YYMMDD, hhmmss, etc) are also accepted.
USAGE
import PySO8601 spam = PySO8601.parse('2011-01-01T14:32') print spam # prints: 2011-01-01 14:32:00 eggs = PySO8601.parse('2010W052') # Week 5, day 2 print eggs # prints: 2010-02-01 00:00:00
For full examples on usage please review the specs in the source.
IMPORTANT NOTES
- Python 3:
PySO8601 is now compatible with Python 2.6, 2.7, and >= 3.3.
- Durations:
parse_duration, when only provided a duration string, will assume 365 days in a year and 30 days in a month, due to the difficult nature of working with calendars. However, passing a start or end timestamp will provide the correct calculation based on that date.
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
File details
Details for the file PySO8601-0.2.0.tar.gz
.
File metadata
- Download URL: PySO8601-0.2.0.tar.gz
- Upload date:
- Size: 7.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1db90482f87280427eda6534d1ff01abe4b606c79ce0ab18f2228bdbf95c5239 |
|
MD5 | 3a324a786df1042e757c3dc45cc26052 |
|
BLAKE2b-256 | dd7668455543fbc9d5bbe5274e3530988ca512bfa96e0263a591bd7ca2bf5244 |