Skip to main content

date-time-handler

Robust date-time formatter with implicit time-zone conversion, wraps datetime and pytz

Out of the box solution for quick and easy proto-type building

  • Uses Python3 standard library time and datetime
  • Requires pytz and dateutil to be installed:
    $ pip3 install pytz
    $ pip3 install python-dateutil
  • date_time_handler package contains class DateTimeHandler with methods that convert timestamp format and time-zone
  • By default, DateTimeHandler performs timezone-naive timestamp format conversion (handy for quick display formatting)
  • For implicit timezone conversion:
    • set destination tz with kwarg time_zone = 'region/local' at instantiation
    • then kwarg start_tz = 'region/local' when converting timestamp format
  • All methods take 'timestamp' in any format: int/float, tuple/struct, formatted_string, and even datetime obj

examples

for time-zone agnostic format conversion

>>> dt_format = DateTimeHandler(date_format = "%Y/%m/%d", clock_format = "%H:%M:%S")
>>> timestring = dt_format.timestring(timestamp)
>>> timetuple = dt_format.timetuple(timestamp)
>>> datestamp = dt_format.datestamp(timestamp)

for time-zone conversion, set destination tz at instantiation

>>> dt_format = DateTimeHandler(time_zone = 'US/Pacific')

    # specify starting timezone when converting timestamp #
>>> local_timestring = dt_format.timestring(utc_timestamp, start_tz = 'UTC')
>>> local_timetuple = dt_format.timetuple(utc_timestamp, start_tz = 'UTC')

so-called 'date' methods return the given timestamp's date @ 00:00:00

>>> local_datestring = dt_format.datestring(utc_timestamp, start_tz = 'UTC')
>>> local_datetuple = dt_format.datetuple(utc_timestamp, start_tz = 'UTC')

Metadata

Release files for date-time-handler 0.0.0.21

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for date-time-handler 0.0.0.21
File Size Uploaded Provenance
date_time_handler-0.0.0.21.tar.gz 3.0 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for date-time-handler 0.0.0.21
File Interpreter ABI Platform
date_time_handler-0.0.0.21-py3-none-any.whl Python 3 none any Details

Total release size: 10.5 kB

Release files / date_time_handler-0.0.0.21.tar.gz

Download URL date_time_handler-0.0.0.21.tar.gz
Size 3.0 kB
Tags Source
SHA-256 checksum
How to use checksums
1ab6376025b364afc340370fa65a6c85e26bbbab014f29990a3c93b80c4bcee0
BLAKE2b-256 checksum
How to use checksums
cb5a41f4109287c6120b7c1de0e1ca3c83c1c157637a6bcc98acd489ad99f56b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.8.4

Release files / date_time_handler-0.0.0.21-py3-none-any.whl

Download URL date_time_handler-0.0.0.21-py3-none-any.whl
Size 7.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
344c0cde4dd4b347d3b435f4d0eb5d83d0673d55184821df0ebe506d318a0d2c
BLAKE2b-256 checksum
How to use checksums
b40d223467b415baa4771b1c4560f8d96dbc287f77b32548be35b61f00c212ad
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.8.4

Security for date-time-handler 0.0.0.21

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page