tremor-runtime icon indicating copy to clipboard operation
tremor-runtime copied to clipboard

stdlib function for formatting nanosecond UTC timestamps as datetime strings

Open mfelsche opened this issue 1 year ago • 0 comments

Add a function for generic formatting according to a format string:

std::datetime::format(<timestamp>, <format>, <timezone>)

with the third parameter optional and defaulting to UTC.

Some constants for common formats (rfc3339, http) would be nice for ease of use.

Additionally add some constants for commonly used timezones, like UTC or others. Optionally also a function to create a timezone from a diff from UTC in hours or minutes.

Invalid formats or timezones will lead to the function erroring.

The internal implementation can make use of the chrono crate. Supported format string escape sequences: https://docs.rs/chrono/latest/chrono/format/strftime/index.html#specifiers

mfelsche avatar Sep 21 '22 07:09 mfelsche