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 time duration conversion module

Installation

pip install duration

Usage

Examples below show how to convert timestamps in hh:mm:ss and mm:ss format to iso8601 strings, integer seconds, datetime.timedelta objects and (hours, minutes, seconds,) deltas

from duration import (
    to_iso8601,
    to_seconds,
    to_timedelta,
    to_tuple,
)

time = '1:23:45'

iso8601 = to_iso8601(time) # 'PT01H23M45S'
seconds = to_seconds(time) # 5025
td = to_timedelta(time) # timedelta(hours=1, minutes=23, seconds=45)
tuple_ = to_tuple(time) # (1, 23, 45,)

Examples above use strict mode by default. In strict mode, conversion functions raise StrictnessError if your duration string meets one of the following conditions:

  1. hh > 23
  2. mm > 59
  3. ss > 59

To disable strict mode, pass strict=False to the conversion function

from duration import (
    to_iso8601,
    to_seconds,
    to_timedelta,
    to_tuple,
)

time = '24:83:25'

iso8601 = to_iso8601(time, strict=False) # 'P1DT01H23M25S'
seconds = to_seconds(time, strict=False) # 91405
td = to_timedelta(time, strict=False) # timedelta(seconds=91405)
tuple_ = to_tuple(time, strict=False) # (25, 23, 25,)
Release History

Release History

1.1.1

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

1.1.0

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

1.0.0

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
duration-1.1.1-py3-none-any.whl (5.2 kB) Copy SHA256 Checksum SHA256 py3 Wheel Jun 16, 2016
duration-1.1.1.tar.gz (4.3 kB) Copy SHA256 Checksum SHA256 Source Jun 16, 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