Working with dates

Jaroslav Bouška Jaroslav Bouška
5. September 2025

Convert date to string

date.to_string <datetime> <pattern> <culture>
FormatResultDescription
"%a""Thu"Short form of the weekday name
"%A""Thursday"Full weekday name
"%b""Sep"Abbreviated month.
"%B""September"Full month name
"%c"Date and time (%a %b %e %T %Y)
"%C""20"Time period
"%d""12"Day of month (time)
"%D""09/12/13"Date (%m/%d/%y)
"%e""12"Day of the month, blank-padded ( 1..31)
"%F""2013-09-12"ISO 8601 date (%Y-%m-%d)
"%h""Sep"Alias for %b
"%H""22"Hour in 24-hour format
"%I""10"Hour in 12-hour clock format.
"%j""255"Day of the year (001..366) (3 digits, left-padded with zeros)
"%k""22"Hour of the time in 24-hour clock format, blank-padded (0..23)
"%l""10"Hour of the time in 12-hour clock format, blank-padded (0..12)
"%L""000"Milliseconds (3 digits, left-padded with zeros)
"%m""09"Month (0..12)
"%o""9"Month, space-padded ( 0..12)
"%M""49"Minutes (2 digits, left-padded with zero, e.g., 01, 02)
"%n"Newline character (\n)
"%N""000000000"Nanoseconds of the time (9 digits, left-padded with zeros)
"%p""PM"Shows AM/PM for the time.
"%P""PM"Shows AM/PM for the time.
"%r""10:49:27 PM"Long time in 12-hour clock format (%I:%M:%S %p)
"%R""22:49"Short time in 24-hour clock format (%H:%M)
"%s"Number of seconds since 1970-01-01 00:00:00 +0000.
"%S""27"Seconds of time
"%t"Tab character (\t)
"%T""22:49:27"Long time in 24-hour clock format (%H:%M:%S)
"%u""4"Day of the week for the time (1 = Monday, 7 = Sunday).
"%U""36"Week number of the current year, with the first week starting on the first Sunday (00..53)
"%v""Sep 12, 2013"VMS date (%e-%b-%Y) (culture-invariant)
"%V""37"Current year’s ISO 8601 week number (01..53)
"%W""36"Week number of the current year, starting with the first Monday as the first day of week 1 (00..53)
"%w""4"Day of the week for the time (0 = Sunday, 6 = Saturday)
"%x"Preferred representation for the date only, no time.
"%X"Preferred representation for time only, no date
"%y""13"Returns the year (without the century) of the time.
"%Y""2013"Year
"%Z""+05:30"Displays the time zone for the time.
"%%""%"Output the character %.