ScriptCore3.FormatDateTime

From Soldat Community Wiki
Jump to: navigation, search
function FormatDateTime(const fmt: string; D: TDateTime): string
 fmt: template to be used when converting
 D: TDateTime to be converted
 Result: conversion result

Description

This function will convert the TDateTime to string using specified template.

! formatting character Description
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
Expand with: description
/ Substituted by DateSeparator value
 : Substituted by TimeSeparator value

Example

Expand with: example