Skip to main content

date62

Compact string-based date(time) format for logging, data engineering, and visualizations.

license pypi python versions tests coverage tested with multipython uses docsub mypy uv ruff openssf best practices

Features

  • Compact: 4 ASCII characters for date, 7 characters for datetime
  • URL safe: uses Base62 encoding
  • Natural sorting
  • Semi-human-readable
  • Covers range from 567-Jan-01 to 3843-Dec-31
  • Arbitrary sub-second precision
  • More readable shortcut form for values between 1970-Jan-01 and 2069-Dec-31
  • Timezone info not supported at the moment
  • Use cases:
    • Logging timestamps
    • Visualize dates on charts
    • Datetime-based file identifiers
    • Sub-second-precision string labels

Installation

$ pip install date62

Examples

date or datetime Date62
2024-Dec-29 24CT, WeCT
2025-Jan-01 2511, Wf11
2025-Jan-01 00:01:02 2511012, Wf11012
2025-Jan-01 00:01:02.345 25110125Z, Wf...
2025-Jan-01 00:01:02.345678 25110125ZAw, Wf...
2025-Jan-01 00:01:02.345678012 25110125ZAw0C, Wf...
2025-Jan-01 00:01:02.345678012345 25110125ZAw0C5Z, Wf...

Usage

Encode

Works for datetime, date, time, int, float, Decimal.

>>> from datetime import datetime
>>> from decimal import Decimal
>>> import date62

>>> d = '2024-12-29 12:34:56.789012'
>>> dtm = datetime.strptime(d, '%Y-%m-%d %H:%M:%S.%f')

>>> date62.encode(dtm)
'WeCTCYu'

>>> date62.encode(dtm, scut=True, prec=2)
'24CTCYuCj0C'

>>> date62.encode(dtm.date(), scut=True)
'24CT'

>>> date62.encode(dtm.time())
'CYu'

>>> date62.encode(dtm.time(), prec=3)
'CYuCj0C00'

>>> t = '1735468496.789012345678'
>>> date62.encode(Decimal(t), scut=True, prec=4)
'24CTAYuCj0C5ZAw'

CLI Reference

$ python -m date62 --help
usage: date62 [-h] [--version] {encode,now,time,today} ...

options:
-h, --help            show this help message and exit
--version             show program's version number and exit

subcommands:
{encode,now,time,today}
encode              Encode ISO 8601 datetime string to Date62 format.
now                 Current local datetime in Date62 format.
time                Current local datetime in Date62 format.
today               Current local date in Date62 format.

date62 encode

$ date62 parse --help
usage: date62 encode [-h] [-n] [-p INT] text

positional arguments:
text            text containing date or datetime

options:
-h, --help      show this help message and exit
-n, --noscut    do not use shortcut form of Date62
-p, --prec INT  sub-second precision: 1=milli, 2=micro, 3=nano, etc.

date62 now

$ date62 now --help
usage: date62 now [-h] [-n] [-p INT]

options:
-h, --help      show this help message and exit
-n, --noscut    do not use shortcut form of Date62
-p, --prec INT  sub-second precision: 1=milli, 2=micro, 3=nano, etc.

date62 time

$ date62 now --help
usage: date62 time [-h] [-p INT]

options:
-h, --help      show this help message and exit
-p, --prec INT  sub-second precision: 1=milli, 2=micro, 3=nano, etc.

date62 today

$ date62 today --help
usage: date62 today [-h] [-n]

options:
-h, --help    show this help message and exit
-n, --noscut  do not use shortcut form of Date62

Contributing

Pull requests, feature requests, and bug reports are welcome!

Authors

  • Michael Makukha

See also

Metadata

Release files for date62 0.2.0

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

Source distribution (sdist)

Source distribution for date62 0.2.0
File Size Uploaded Provenance Actions
date62-0.2.0.tar.gz 105.1 kB Without provenance Details for date62-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for date62 0.2.0
File Interpreter ABI Platform Actions
date62-0.2.0-py2.py3-none-any.whl Python 2, Python 3 none any Details for date62-0.2.0-py2.py3-none-any.whl

Total release size: 113.5 kB

Release files / date62-0.2.0.tar.gz

Download URL date62-0.2.0.tar.gz
Size 105.1 kB
Tags Source
SHA-256 checksum
How to use checksums
921b4f2538935c553c475873ec5d2fda20ee6693f60ea122fda5b08b88f794f2
BLAKE2b-256 checksum
How to use checksums
003232c9d6f6e84396a4d8cd8e6cae07403e452777e8f41016f46664e80d95bc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.6.12

Release files / date62-0.2.0-py2.py3-none-any.whl

Download URL date62-0.2.0-py2.py3-none-any.whl
Size 8.4 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
abb46dda9bbf2a23faefa519f99cbab6d965170a075236a0d89457c6c2f39b26
BLAKE2b-256 checksum
How to use checksums
40563a984fa1600f3d147c827c85406ee0418119c13c3f1c63fa4223b9598e82
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.6.12

Security for date62 0.2.0

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.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files No provenance

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