Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

UNKNOWN

Project Description

DerpTime helps you to calculate deifferences between datetimes while excluding weekends (calculating with workdays only).

Typical usage:

#!/usr/bin/env python

from derptime import WorkingHoursDateTime
from datetime import datetime, timedelta

whdt = WorkingHoursDateTime(2013,11,11,10,10)

if (whdt - timedelta(hours=24)) > datetime.now():
    print "We still have some time before the deadline!"

Usage

Adding timedelta objects::

>>> from derptime import WorkingHoursDateTime
>>> from datetime import timedelta
>>>
>>> WorkingHoursDateTime(2013,11,8,10,10) + timedelta(hours=24)
WorkingHoursDateTime(2013, 11, 11, 10, 10)

Subtracting timedelta objects::

>>> from derptime import WorkingHoursDateTime
>>> from datetime import timedelta
>>>
>>> WorkingHoursDateTime(2013,11,11,10,10) - timedelta(hours=24)
WorkingHoursDateTime(2013, 11, 8, 10, 10)

Subtracting WorkingHoursDateTime and/or datetime objects::

>>> from derptime import WorkingHoursDateTime
>>> from datetime import datetime, timedelta
>>>
>>> WorkingHoursDateTime(2013,11,11,10,10) - WorkingHoursDateTime(2013,11,8,10,10)
datetime.timedelta(1)
>>>
>>> WorkingHoursDateTime(2013,11,11,10,10) - datetime(2013,11,8,10,10)
datetime.timedelta(1)

Convert from datetime::

>>> from derptime import WorkingHoursDateTime
>>> from datetime import datetime
>>>
>>> WorkingHoursDateTime.from_datetime(datetime(2013,11,8,10,10))
WorkingHoursDateTime(2013, 11, 8, 10, 10)

Convert to datetime::

>>> from derptime import WorkingHoursDateTime
>>> from datetime import datetime
>>>
>>> WorkingHoursDateTime(2013,11,11,10,10).to_datetime()
datetime.datetime(2013, 11, 11, 10, 10)

Using now::

>>> from derptime import WorkingHoursDateTime
>>>
>>> # You can still use the good-old "new" classmethod the same way
>>> WorkingHoursDateTime.now()
WorkingHoursDateTime(2013, 11, 8, 16, 29, 28, 977699)
Release History

Release History

This version
History Node

0.2.1

History Node

0.2

History Node

0.1

Download Files

Download Files

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

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
DerpTime-0.2.1.tar.gz (3.2 kB) Copy SHA256 Checksum SHA256 Source Jun 17, 2014

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS 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