Skip to main content

Temporis is a Python library for elegantly managing and transforming dates and times. It provides intuitive tools for handling temporal data, making time calculations, conversions, and formatting simple and efficient.

Project description

TEMPORIS

Temporis is a Python library for elegantly managing and transforming dates and times.

license last-commit repo-top-language repo-top-language


Overview

Temporis is a developer tool created to help with the problem of using and managing dates in Python. Supporting the use and change of the different time uses, operate and modify dates and their formats.

Features

  • Definition and use of different time changes
  • Format for formatting dates to different str, datetime or date format
  • Performing different types of operations with a datetime
    • Add or subtract hours, days, months
    • Get the next business day, quarter, semester or year
    • Identify if a datetime is a business day, weekend or holiday
    • Get the difference between two datetime

Installation

pip install temporis

Usage

Create a new datetime object

from datetime import datetime
from temporis.temporis import Temporis
from temporis.format import TemporisFormat
from temporis.timezone import TemporisTz


# Create a new datetime object
dt = datetime(2021, 1, 1, 0, 0, 0)
# Add 5 hours to the datetime
dt = Temporis.add_hours(dt, 5)
# Add 5 days to the datetime
dt = Temporis.add_days(dt, 5)
# Minus 5 months to the datetime
dt = Temporis.add_months(dt, -5)
# Get the next business day
dt = Temporis.next_business_day(dt)
# Get the next quarter
dt = Temporis.next_quarter(dt)
# Apply UTC timezone to the datetime
dt = TemporisTz.to_UTC(dt)
# Print the datetime
print(Temporis.to_str(dt, format_str=TemporisFormat.YEAR_MONTH_DAY))

Repository Structure

└── temporis/
    ├── LICENSE
    ├── pdm.lock
    ├── pyproject.toml
    ├── README.md
    ├── src
       └── temporis
    └── tests
        ├── __init__.py
        ├── test_datetime.py
        └── test_timezone.py

License

temporis is distributed under the terms of the MIT license.

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

temporis-1.0.2.tar.gz (14.0 kB view hashes)

Uploaded Source

Built Distribution

temporis-1.0.2-py3-none-any.whl (13.1 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page