formatTimeRef

Formats the given UNIX timestamp into the form specified by the format string. If no format string is given, 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 dynamic array.

formatTimeRef
(
time_t timestamp
,,
cstring format_string = "%F %T\0"
,
uint max_output_len = 50
)

Parameters

timestamp time_t

timestamp to format

output mstring

slice to destination string buffer

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

max_output_len uint

maximum length of the resulting string post-conversion (defaults to 50)

Return Value

Type: mstring

the formatted string, may be an empty slice if the result exceeds the maximum output length specified or if an error occurred

Meta