Práce s datem

Jaroslav Bouška Jaroslav Bouška
5. dubna 2023

date.to_string

date.to_string <datetime> <pattern> <culture>
FormatResultDescription
"%a""Thu"Name of week day in short form of the
"%A""Thursday"Week day in full form of the time
"%b""Sep"Month in short form of the time
"%B""September"Month in full form of the time
"%c"Date and time (%a %b %e %T %Y)
"%C""20"Century of the time
"%d""12"Day of the month of the 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 of the time in 24 hour clock format
"%I""10"Hour of the time in 12 hour clock format
"%j""255"Day of the year (001..366) (3 digits, left padded with zero)
"%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"Millisecond of the time (3 digits, left padded with zero)
"%m""09"Month of the time( 0..12)
"%o""9"Month of the time, blank-padded ( 0..12)
"%M""49"Minutes of the time (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 zero)
"%p""PM"Gives AM / PM of the time
"%P""pm"Gives am / pm of 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 the time
"%t"Tab character (\t)
"%T""22:49:27"Long time in 24 hour clock format (%H:%M:%S)
"%u""4"Day of week of the time (from 1 for Monday to 7 for Sunday)
"%U""36"Week number of the current year, starting with the first Sunday as the first day of the first week (00..53)
"%v""12-SEP-2013"VMS date (%e-%b-%Y) (culture invariant)
"%V""37"Week number of the current year according to ISO 8601 (01..53)
"%W""36"Week number of the current year, starting with the first Monday as the first day of the first week (00..53)
"%w""4"Day of week of the time (from 0 for Sunday to 6 for Saturday)
"%x"Preferred representation for the date alone, no time
"%X"Preferred representation for the time alone, no date
"%y""13"Gives year without century of the time
"%Y""2013"Year of the time
"%Z""+05:30"Gives Time Zone of the time
"%%""%"Output the character %