[Previous][Up][Next] Reference for unit 'sysutils' (#rtl)

Date and time formatting characters

Various date and time formatting routines accept a format string to format the date and or time. The following characters can be used to control the date and time formatting:

c
Formats date using shortdateformat and formats time using longtimeformat if the time is not zero.
f
Same as c, but adds the time even if it is zero.
d
day of month
dd
day of month (leading zero)
ddd
day of week (abbreviation)
dddd
day of week (full)
ddddd
shortdateformat
dddddd
longdateformat
m
month
mm
month (leading zero)
mmm
month (abbreviation)
mmmm
month (full)
y
year (2 digits)
yy
year (two digits)
yyyy
year (with century)
h
hour
hh
hour (leading zero)
n
minute
nn
minute (leading zero)
s
second
ss
second (leading zero)
t
shorttimeformat
tt
longtimeformat
am/pm
use 12 hour clock and display am and pm accordingly
a/p
use 12 hour clock and display a and p accordingly
/
insert date seperator
:
insert time seperator
"xx"
literal text
'xx'
literal text
z
milliseconds
zzz
milliseconds(leading zero)

The date and time separators are taken from the DefaultFormatSettings record, unless a TFormatSettings record is passed to the FormatDateTime function.

Note that to include any of the above characters literally in the result string, they must be enclosed in double quotes.

See also

DefaultFormatSettings

  

Storage for default settings

TFormatSettings

  

Record with all the strings that determine formatting

FormatDateTime

  

Return a string representation of a TDateTime value with a given format.


Documentation generated on: Nov 14 2015