LocalizeTimeStamp (open)
Returns a string containing a formatted time.
Syntax
LOADLIB "wh::util/localization.whlib";
STRING FUNCTION LocalizeTimeStamp(STRING formatstring, INTEGER timestamp, STRING locale, BOOLEAN useexact)
Parameters
STRING formatstring
Specifies the way the time stamp should be formatted
INTEGER timestamp
The time stamp to format
STRING locale
The language or locale to use (e.g. 'en', 'en-GB', 'nl' or 'zh-Hans-CN')
BOOLEAN useexact
If set to TRUE, use the exact pattern supplied, otherwise find a locale matching pattern (this defaults to FALSE, so supplying "Hms" as the format will produce "12:03:04", if set to TRUE, it will produce the literal "1234")
Return value
STRING
A string with the formatted time. If an invalid @italic time stamp value was entered, the function returns an empty string
Description
This function returns a string, containing the given time in a user-specified format. See LocalizeDateTime for more information about formatting strings. As time stamps are date-independent, it does not make sense to supply date-specific format specifiers, including timezone.
Examples
// Example timestamp: 21:03:04.555
INTEGER timestamp := ((21 * 60 + 3) * 60 + 4) * 1000 + 555;
// The time stamp in American English notation.
// example1 = "9:03:04.555 PM"
STRING example1 := LocalizeTimeStamp("jmsSSS", timestamp, "en");
// The time stamp in British English notation.
// example2 = "21:03:04.555"
STRING example2 := LocalizeTimeStamp("jmsSSS", timestamp, "en-GB");
// The time stamp in Dutch notation.
// example3 := "21:03:04,555"
STRING example3 := LocalizeTimeStamp("jmsSSS", timestamp, "nl");