s = timestring(ʃtimestamp_formatʅʃ, timestamp_valueʅ);
The
timestring function returns a formatted string containing the date and time as represented by a
UNIX time, but using the local machine's time zone (instead of UTC).
The optional string expression
timestamp_format contains date and time formatters. You can view a list of these formatters on a webpage about the C function
strftime. If no formatter is supplied, the function returns an expression based on the machine's local settings using the formatter
"%c" (note that the
"%c" formatter is locale-dependent and so will return a slightly different layout depending on where it is invoked).
The optional numeric expression
timestamp_value allows you to use a date/time value that came from the
timestamp function. If not supplied, the function uses the current date/time.
The function returns the custom formatted date and time string.
// if the current date (the default when no argument is given) is 12/27/2021,
// then the text displayed would be "Week 52"
errmsg("Week %s", timestring("%W"));
// if living in EST, the string will display "Fri May 5 08:00:00 2000"
numeric cspro_first_release_timestamp = 957528000;
errmsg("%s", timestring(cspro_first_release_timestamp));
// the following will display the string "Friday May 05, 2000"
errmsg("%s", timestring("%A %B %d, %Y", cspro_first_release_timestamp));