Skip to main content

Tools for working with timezone-aware datetimes.

Project description

timezone-tools

Helpers for working with timezone-aware date-times.

This package provides:

  • TimezoneConverter for making date-times timezone-aware and converting between timezones.
  • Clock for getting the current time/date in a specific timezone.

TimezoneConverter

This converter object can be used to create timezone-aware datetime objects, to make a naive datetime timezone-aware, and to localize other timezone-aware datetime objects.

The converter also provides utilities for converting a datetime into a date in the converter's timezone, calculating dates and time relative to a datetime, and rounding a datetime to the nearest increment of time (e.g. to the nearest half-hour).

Create an instance of the timezone converter by passing it an IANA time zone name.

from timezone_tools import TimezoneConverter

paris_time = TimezoneConverter("Europe/Paris")

For more information about timezone support in Python, see the documentation for the zoneinfo module.

Clock

This clock object can be used to access the system clock and provides timezone-aware dates and times.

The clock also provides utilities for calculating dates and time relative to the current moment.

Create an instance of the clock by passing it an IANA time zone name.

from timezone_tools import Clock

paris_time = Clock("Europe/Paris")

For more information about timezone support in Python, see the documentation for the zoneinfo module.

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

timezone_tools-0.1.0.tar.gz (12.8 kB view details)

Uploaded Source

Built Distribution

timezone_tools-0.1.0-py3-none-any.whl (9.1 kB view details)

Uploaded Python 3

File details

Details for the file timezone_tools-0.1.0.tar.gz.

File metadata

  • Download URL: timezone_tools-0.1.0.tar.gz
  • Upload date:
  • Size: 12.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.0 CPython/3.12.4

File hashes

Hashes for timezone_tools-0.1.0.tar.gz
Algorithm Hash digest
SHA256 0cce872ae35d2d63876d99c5c78b08697495b5d3c241ae4e2315820c05682380
MD5 fb94091f07dbc73ec3f9e69fb1407222
BLAKE2b-256 0a1fdf0f33769379e6d04e5e3304506d1d863364bb81d646c217d13361e4470c

See more details on using hashes here.

File details

Details for the file timezone_tools-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for timezone_tools-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6da9d91601dad037af38757ce83d08556cf8fb9b37b688ef659da3a830fa74ab
MD5 3a4e3012b77ab57fdd3404fd49c53ccc
BLAKE2b-256 234c5ee8fadd55cf60faa9c0754b8499321bfdf8c121133d984cec487634ba11

See more details on using hashes here.

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