{"id":4788,"library":"strict-rfc3339","title":"Strict RFC3339","description":"strict-rfc3339 is a Python library providing strict, simple, and lightweight functions for converting Unix timestamps to and from RFC3339 formatted strings. It aims to avoid the complexities of timezones as much as possible, focusing on strict adherence to the RFC3339 standard. The current version is 0.7, with development appearing to be in maintenance mode, as the last release was in April 2016.","status":"maintenance","version":"0.7","language":"en","source_language":"en","source_url":"https://github.com/danielrichman/strict-rfc3339","tags":["rfc3339","date-time","timestamp","validation","timezone-aware"],"install":[{"cmd":"pip install strict-rfc3339","lang":"bash","label":"Install latest version"}],"dependencies":[],"imports":[{"symbol":"validate_rfc3339","correct":"import strict_rfc3339\nstrict_rfc3339.validate_rfc3339(...)"},{"symbol":"rfc3339_to_timestamp","correct":"import strict_rfc3339\nstrict_rfc3339.rfc3339_to_timestamp(...)"},{"symbol":"timestamp_to_rfc3339_utc","correct":"import strict_rfc3339\nstrict_rfc3339.timestamp_to_rfc3339_utc(...)"},{"symbol":"now_to_rfc3339_utc","correct":"import strict_rfc3339\nstrict_rfc3339.now_to_rfc3339_utc()"},{"symbol":"now_to_rfc3339_localoffset","correct":"import strict_rfc3339\nstrict_rfc3339.now_to_rfc3339_localoffset()"}],"quickstart":{"code":"import strict_rfc3339\nimport time\n\n# Get current UTC time as RFC3339 string\nrfc3339_now_utc = strict_rfc3339.now_to_rfc3339_utc()\nprint(f\"Current UTC RFC3339: {rfc3339_now_utc}\")\n\n# Get current local time as RFC3339 string with local offset\nrfc3339_now_local = strict_rfc3339.now_to_rfc3339_localoffset()\nprint(f\"Current Local RFC3339: {rfc3339_now_local}\")\n\n# Validate an RFC3339 string\nis_valid = strict_rfc3339.validate_rfc3339(\"2023-10-27T10:00:00Z\")\nprint(f\"'2023-10-27T10:00:00Z' is valid: {is_valid}\")\n\nis_invalid = strict_rfc3339.validate_rfc3339(\"some rubbish\")\nprint(f\"'some rubbish' is valid: {is_invalid}\")\n\n# Convert RFC3339 to Unix timestamp\ntimestamp = strict_rfc3339.rfc3339_to_timestamp(\"2023-10-27T10:00:00+00:00\")\nprint(f\"Timestamp for '2023-10-27T10:00:00+00:00': {timestamp}\")\nprint(f\"Time tuple (UTC): {time.gmtime(timestamp)[:6]}\")\n\n# Convert Unix timestamp to RFC3339 (UTC)\nnew_rfc3339_utc = strict_rfc3339.timestamp_to_rfc3339_utc(timestamp)\nprint(f\"Timestamp {timestamp} to RFC3339 UTC: {new_rfc3339_utc}\")","lang":"python","description":"This quickstart demonstrates how to obtain the current time in RFC3339 format (UTC or local offset), validate an RFC3339 string, and convert between RFC3339 strings and Unix timestamps. It highlights the library's core functionalities for strict RFC3339 handling."},"warnings":[{"fix":"Be aware of this limitation; if leap second precision is critical, this library may not be suitable without external handling of leap seconds.","message":"The library does not support leap seconds. In validation, seconds values of '60' or '61' are rejected, as Python's native timestamps do not support them, and validating them accurately would require constantly updated timezone data.","severity":"gotcha","affected_versions":"0.1 - 0.7"},{"fix":"Consider this limitation when deploying on 32-bit systems or working with dates outside this range. For such cases, consider alternative libraries or custom handling.","message":"On 32-bit systems, RFC3339 generation using `gmtime` or `localtime` may be limited by the size of `time_t`, typically restricting dates to between approximately 1901 and 2038. This limitation does not affect `rfc3339_to_timestamp`.","severity":"gotcha","affected_versions":"0.1 - 0.7"},{"fix":"Understand that the library focuses purely on RFC3339 string parsing and generation based on Unix timestamps, not complex timezone arithmetic. If full timezone support beyond RFC3339 offsets is needed, integrate with a dedicated timezone library, ensuring careful handling of conversions.","message":"The library explicitly avoids direct usage of Python's `datetime` objects and comprehensive timezone libraries like `pytz` to prevent common issues related to DST transitions and ambiguous times. This means that while it strictly handles RFC3339 offsets, it does not provide full timezone conversion capabilities itself.","severity":"gotcha","affected_versions":"0.1 - 0.7"}],"env_vars":null,"last_verified":"2026-04-12T00:00:00.000Z","next_check":"2026-07-11T00:00:00.000Z"}