Skip to main content

A simple library for common date and time manipulations

Project description

dttols

A simple library for common date and time manipulations.

Installation

pip pip install dttools

Usage

# Adding Business Days
from dttools import add_business_days
from datetime import datetime

start_date = datetime(2023, 11, 10)
new_date = add_business_days(start_date, 5)
print(new_date)  # Output: A date 5 business days from the start_date, skipping weekends
# Calculating Business Days Between Dates
from dttools import days_between_in_business_days
from datetime import datetime

start_date = datetime(2023, 11, 1)
end_date = datetime(2023, 11, 10)
business_days = days_between_in_business_days(start_date, end_date)
print(business_days)  # Output: The count of business days between the two dates
# Formatting Relative Dates
from dttools import format_relative_date
from datetime import datetime, timedelta

some_date = datetime.now() - timedelta(days=3)
relative_format = format_relative_date(some_date)
print(relative_format)  # Output: "3 days ago"
# Converting to a Specific Time Zone
from dttools import to_timezone
from datetime import datetime

utc_time = datetime.utcnow()
new_york_time = to_timezone(utc_time, "America/New_York")
print(new_york_time)  # Output: The datetime converted to New York time

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

dttools-0.1.2.tar.gz (2.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dttools-0.1.2-py3-none-any.whl (2.6 kB view details)

Uploaded Python 3

File details

Details for the file dttools-0.1.2.tar.gz.

File metadata

  • Download URL: dttools-0.1.2.tar.gz
  • Upload date:
  • Size: 2.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.9

File hashes

Hashes for dttools-0.1.2.tar.gz
Algorithm Hash digest
SHA256 5af520f6240fa62066bd5130fd8f1f4efbe3500d90a9fcee3b8622aab7dc5e8b
MD5 a6069b7f3111657452bd5293d40f2789
BLAKE2b-256 3786056868c71b9b96e98e42dbad1e2eb17c18f6ce5250de280f379acd95c1f0

See more details on using hashes here.

File details

Details for the file dttools-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: dttools-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 2.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.9

File hashes

Hashes for dttools-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 036a93b3ceb18d3844c0602285a1a09d9314afb07c093162bb547b8a717b7339
MD5 b7ee601822e9bb3911e54e213deb3e9b
BLAKE2b-256 62bb7e0ae13a8aba840b2802bb54d01ec8f49cf6053edd5b658d5ebeefa355e6

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