Skip to main content

Dependency-free UTC timestamp string generation helper (YYYY-MM-DDTHH:MM:SSZ).

Project description

GenUTCStamp

A tiny, dependency-free Python utility that returns a UTC timestamp string in the form:

YYYY-MM-DDTHH:MM:SSZ

This format is ISO 8601 compatible and commonly accepted as an RFC 3339-style timestamp (UTC “Zulu” suffix Z). The implementation uses only the Python standard library time module.

Why this package exists

You often may need a stable UTC timestamp string for:

  • log lines and structured logs
  • environment-variable status markers
  • lightweight monitoring / alerting breadcrumbs
  • file naming or report identifiers

When the goal is “a portable UTC timestamp string with no dependencies,” this package provides that.

Installation

python -m pip install --upgrade pip
python -m pip install GenUTCStamp

Quick usage

Note: Python imports are case-sensitive on Linux. pip install GenUTCStamp works regardless of casing, but import GenUTCStamp and import genutcstamp are different names. This project supports both.

import genutcstamp as utc

print(utc.utc_ts())
# 2026-01-17T18:41:47Z

API surface (aliases)

All public functions return the exact same value format and are simple aliases for convenience:

  • GenerateUTCTimestampPortable()
  • utc_ts()
  • GenerateUTCTimestamp()
  • GenerateTimestamp()
  • gen_ts()
  • GenTs()
  • gen_utc()
  • GenerUTC()
  • GenUTC()
  • GenUTCToString()
  • gen_utc_str()
  • UTCToString()
  • utc_to_str_threadsafe()
  • GenUTCStamp()
import genutcstamp as utc2
print(utc2.utc_ts())

Output guarantees

  • Always returns a string.
  • Normal path returns UTC time formatted as YYYY-MM-DDTHH:MM:SSZ.
  • On unexpected runtime failures, returns a defensive fallback string: 1970-01-01T00:00:00Z.

Command line

This package optionally provides a small CLI:

utc-ts
utc-ts -n 5
utc-ts --n 5   # backward compatible with v1.0.0

License

MIT

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

genutcstamp-1.0.1.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

genutcstamp-1.0.1-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

Details for the file genutcstamp-1.0.1.tar.gz.

File metadata

  • Download URL: genutcstamp-1.0.1.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for genutcstamp-1.0.1.tar.gz
Algorithm Hash digest
SHA256 3f8e22e48882b40dd4a0a582c6cfa4e97dc64e0324b21c539a106b40cec51cec
MD5 f9242e894f2ce87b59f00fc35e71aea1
BLAKE2b-256 73867e2349cd4963c9f8f1de38b3e1522c7504f5650f46d9f18d71ec0e22d793

See more details on using hashes here.

File details

Details for the file genutcstamp-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: genutcstamp-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 5.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for genutcstamp-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4704d1b0acf5ae2b8f1a6957045c1a25018ffcdb0c9d05b6b58c29f75a9539cb
MD5 85a6bd3be71a479aaba5a81fc9b07d2e
BLAKE2b-256 122d58af17dfbe86ac7afe13c7aa4da229310d576a720cf2e465a9a76343c5ef

See more details on using hashes here.

Supported by

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