Function: TimeFormat
Function: TimeFormat

Function: TimeFormat


Converts a time integer into a readable string.


Parameter Type Description
TIME VALUE(INTEGER) Time in milliseconds since the UNIX Epoch.


VALUE(STRING) The output string after formatting.

What It Does

This function returns a string representation of the provided time, using the provided formatting string to define what to put in the string.

The formatting string uses repeated patterns of the following letters to output parts of the provided time. The formatting string can output quoted characters as-is if those series of characters are enclosed in single-quotes ('). Unrecognized characters are output as-is.

"Text" types print full names at 4 or more of the same letter (or may max out at less letters), "number" types print a minimum of the amount of digits represented by the amount of letters, padding the rest of the digits with zeroes, "month" types print numbers at 2 or less letters, text at 3 or more.

Letter Part of Date Type Examples
e Era Designator (lowercase) Text a; ad
E Era Designator (uppercase) Text A; AD
y Year Number 2009
M Month in Year Month 9; 09; Sep; September
d Day in Month Number 5; 05
W Day of Week in Month (Name) Text T; Tu; Tue; Tuesday
w Day Number of Week (0=Sunday, ... , 6=Saturday) Number 2
a am/pm marker (lower case) Text a; am
A AM/PM marker (upper case) Text A; AM
h Hour in Day (0-23)
"24-hour clock"
Number 8; 08
H Hour in Day (1-24) Number 9; 09
k Hour in Day (AM/PM) (0-11)
0 is first hour of meridian, 11 is last.
Number 8; 08
K Hour in Day (AM/PM) (1-12)
"12-hour clock" (12 is first hour of meridian, 11 is last)
Number 9; 09
m Minute in Hour Number 3; 03
s Seconds in Minute Number 3; 03
S Milliseconds in Second Number 567
z Time Zone Text GMT-08:00
Z RFC 822 Time Zone Text -0800
X Variable Length Time Zone Text -8; -08; -0800; -08:00; GMT-08:00


TimeFormat Example

		local time = time();
		textln("The current UNIX time in milliseconds is " + time + ".");
		textln("Which is " + timeFormat(time, "yyyy-MM-dd KK:mm:ss AA', a 'WWWW"));

See Also

Time() — Returns the system time.

Additional Technical Notes

The output date and time are affected by local time zone, which, according to implementation, may be affected by system date/time or other things that affect implementation locale.


Modal Header