time_convert
Convert timestamps between formats like ISO 8601, RFC 2822, Unix epoch, and time zones. Specify input format and time zone, output format and zone, returns converted timestamp and detection details.
Instructions
Convert a timestamp between textual formats (ISO 8601/RFC 2822/HTTP/unix/strftime) and time zones.
Parses value per from_format (auto sniffs iso8601/rfc2822/http/unix),
anchors a NAIVE result with from_zone (an input that already carries an
offset ignores it), shifts the instant into to_zone, and renders it as
to_format. Formats: iso8601 (RFC 3339), rfc2822, http (IMF-fixdate, always
GMT), unix/unix_ms/unix_us/unix_ns epoch, and strftime (needs format_pattern
on whichever side uses it). Zones are an IANA name (Europe/Budapest), UTC, or
a ±HH:MM offset. Returns {result, from_format, to_format, zone, unix};
from_format echoes the detected format under auto, unix is the integer
epoch-seconds anchor.
Example: time_convert("1700000000", "iso8601") -> result
"2023-11-14T22:13:20+00:00"
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| value | Yes | Timestamp to convert, parsed per `from_format`. | |
| to_format | Yes | Output format: iso8601 (RFC 3339), rfc2822, http (IMF-fixdate, always GMT), unix/unix_ms/unix_us/unix_ns epoch, or strftime (needs `format_pattern`). | |
| from_format | No | Format of `value`; default 'auto' sniffs iso8601/rfc2822/http/unix. strftime needs `format_pattern`. | auto |
| from_zone | No | Zone anchoring a naive input (no offset): an IANA name (Europe/Budapest), UTC, or a ±HH:MM offset. Default 'UTC'. Ignored when the input already carries an offset. | UTC |
| to_zone | No | Zone to shift the instant into before rendering; IANA name, UTC, or ±HH:MM offset. Default 'UTC'. Ignored for http (always GMT). | UTC |
| format_pattern | No | strptime/strftime pattern, required on whichever side (from_format/to_format) is 'strftime'. Default None. |