FormatTimeStamp (open)

Returns a string containing a formatted time.


LOADLIB "wh::datetime.whlib";

STRING FUNCTION FormatTimeStamp(STRING formatstring, INTEGER64 timestamp, STRING datetexts)


STRING formatstring

Specifies the way the time stamp should be formatted.

INTEGER64 timestamp

The time stamp to format (the number of milliseconds since midnight)

STRING datetexts

Specifies the texts for am, pm, all months and days in their full name and their 2 or 3 character abbreviation format. The default language is English. "NL" switches the language to Dutch, "DE" switches to German and "JP" to Japanese. It is also possible to specify your own DateTime language string where you separate the substrings with semicolons. This string should be in the following format: "am;pm;January;...;December;Monday;...;Sunday;Jan;...;Dec;Mon;...;Sun;"

Return value


A string with the formatted time. If an invalid @italic time value was entered, the function returns an empty string


@italic FormatTimeStamp() returns a string, containing the given time in a user-specified format. Optionally, language-specific strings for month and day names may be specified through the datetexts parameter. By default the English language strings will be used. As time stamps are date-independent, it does not make sense to supply date-specific format specifiers.


// 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 := FormatTimeStamp("%#I:%M:%S.%Q %p", timestamp);

// The time stamp in Dutch notation (note that in this notation the language parameter is not actually used).
// example2 := "21:03:04,555"
STRING example2 := FormatTimeStamp("%#H:%M:%S,%Q", timestamp, "nl");