FormatDate

From Soldat Community Wiki
Jump to: navigation, search

From the Scripting Manual

function FormatDate(FormatString: string): string

Parameter Info:
 FormatString (String): Format to be used on the date.

Description:
The following (non-Asian) formatting character strings can be used in the FormatString string:

y 	= Year last 2 digits
yy 	= Year last 2 digits
yyyy 	= Year as 4 digits
m 	= Month number no-leading 0
mm 	= Month number as 2 digits
mmm 	= Month using ShortDayNames (Jan)
mmmm 	= Month using LongDayNames (January)
d 	= Day number no-leading 0
dd 	= Day number as 2 digits
ddd 	= Day using ShortDayNames (Sun)
dddd 	= Day using LongDayNames  (Sunday)
ddddd 	= Day in ShortDateFormat
dddddd 	= Day in LongDateFormat
	
c 	= Use ShortDateFormat + LongTimeFormat
h  	= Hour number no-leading 0
hh 	= Hour number as 2 digits
n	= Minute number no-leading 0
nn 	= Minute number as 2 digits
s 	= Second number no-leading 0
ss 	= Second number as 2 digits
z	= Milli-sec number no-leading 0s
zzz 	= Milli-sec number as 3 digits
t 	= Use ShortTimeFormat
tt 	= Use LongTimeFormat
	
am/pm 	= Use after h : gives 12 hours + am/pm
a/p 	= Use after h : gives 12 hours + a/p
ampm 	= As a/p but TimeAMString,TimePMString
/ 	= Substituted by DateSeparator value
:	= Substituted by TimeSeparator value

Examples

begin
WriteLn('The time is currently '+FormatDate('hh:nn:ss am/pm'));
end;


External Links