formatTime

Formats the given UNIX timestamp into the form specified by the format string. If no format string is given, and the length of the destination output buffer has been set to at least 20 characters, then the timestamp will be formatted into the form 1982-09-15 10:37:29.

Refer to the manual page of strftime for the various conversion specifications that can be used to construct the format string.

This function should be preferred when formatting the time into a static array.

formatTime

Parameters

timestamp time_t

timestamp to format

output mstring

slice to destination string buffer, must be long enough to contain the resulting string post-conversion

format_string cstring

format string to define how the timestamp should be formatted, must be null-terminated (defaults to "%F %T\0") note that the format string requires an explicit '\0' even if string literals are being passed

Return Value

Type: mstring

slice to the string formatted in 'output', may be an empty slice if the provided buffer is too small or if an error occurred

Meta