Skip to main content

A few conveniences to do with dates and times.

Latest release 20230210:

  • Drop Python 2 support.
  • Make timezones mandatory where previously they were assumed.

There are some other PyPI modules providing richer date handling than the stdlib datetime module. This module mostly contains conveniences used in my other code; you're welcome to it, but it does not pretend to be large or complete.

Function datetime2unixtime(dt)

Convert a timezone aware datetime to a UNIX timestamp.

Function isodate(when=None, dashed=True)

Return a date in ISO8601 YYYY-MM-DD format, or YYYYMMDD if not dashed.

Modern Pythons have a datetime.isoformat method, you use that.

Function localdate2unixtime(d)

Convert a localtime date into a UNIX timestamp.

Class tzinfoHHMM(datetime.tzinfo)

tzinfo class based on +HHMM / -HHMM strings.

Function unixtime2datetime(unixtime, *, tz: datetime.tzinfo)

Convert a a UNIX timestamp to a datetime in the timezone tz.

Class UNIXTimeMixin

A mixin for classes with a .unixtime attribute, a float storing a UNIX timestamp.

Release Log

Release 20230210:

  • Drop Python 2 support.
  • Make timezones mandatory where previously they were assumed.

Release 20210306: Initial release, used by cs.sqltags.

Metadata

Release files for cs-dateutils 20230210

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

Source distribution (sdist)

Source distribution for cs-dateutils 20230210
File Size Uploaded Provenance
cs.dateutils-20230210.tar.gz 3.5 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for cs-dateutils 20230210
File Interpreter ABI Platform
cs.dateutils-20230210-py3-none-any.whl Python 3 none any Details

Total release size: 6.9 kB

Release files / cs.dateutils-20230210.tar.gz

Download URL cs.dateutils-20230210.tar.gz
Size 3.5 kB
Tags Source
SHA-256 checksum
How to use checksums
a7f2add547da96c0f885a9c6420b52296c22caf0cf77d950a817bdecf26a9e88
BLAKE2b-256 checksum
How to use checksums
8897a11c57fe1a6bc9f060163f5a7ec538dd8571798a554650e8e1bab6a5b689
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.13

Release files / cs.dateutils-20230210-py3-none-any.whl

Download URL cs.dateutils-20230210-py3-none-any.whl
Size 3.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bfeabf1700b480c5c8a46eeb3c74786174606515ca31737041b20f794a60348f
BLAKE2b-256 checksum
How to use checksums
4c719aadbc5fc475a4d88750ec1e12d8280ad09288b3def60c796250b56adf2e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.13

Security for cs-dateutils 20230210

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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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