Datetime Intrinsic Functions - AsCustomDisplayString Method

Returns the date in a user defined format

Member of Datetime Intrinsic Functions (PRIM_LIBI.IDateTimeIntrinsics)

Parameters

NameTypeData TypeDescription
Result*Result (Optional)StringResulting custom format string
DateFormat*InputStringUser defined date format
TimeFormat*InputStringUser defined time format

Details

AsCustomDisplayString returns the date and time formatted using the supplied formatting strings.
 
Each portion of the custom definition is evaluated independently and then concatenated to produce the output.

Date Format

Enum ValueDescription
YShort year with suppressed leading zero e.g. 4
YYShort year e.g. 04
YYYLong year e.g. 2004
MShort month with suppressed leading zero e.g. 4
MMShort month e.g. 04
MMMAbbreviated month e.g. Apr
MMMMLong month e.g. April
DShort date with suppressed leading zero e.g. 4
DDShort date e.g. 04
DDDAbbreviated date name e.g. Wed
DDDDLong date name e.g. Wednesday

Time Format

Enum ValueDescription
h12 hour clock with suppressed leading zero e.g. 9
hh12 hour clock e.g. 09
H24 hour clock with suppressed leading zero e.g. 9
HH24 hour clock e.g. 21
mMinutes with suppressed leading zero e.g. 4
mmMinutes e.g. 04
sSeconds with suppressed leading zero e.g. 4
ssSeconds e.g. 04
fMilliseconds with suppressed leading zeros e.g. 4
ffMilliseconds with suppressed leading zeros e.g. 04
fffMilliseconds e.g. 004
uMicroseconds with suppressed leading zeros e.g. 4
uuMicroseconds with suppressed leading zeros e.g. 04
uuuMicroseconds e.g. 004
nNanoseconds with suppressed leading zeros e.g. 4
nnNanoseconds with suppressed leading zeros e.g. 04
nnnNanoseconds e.g. 004
tA or P
ttAM or PM

Example

This example would produce the output 07/08/12 05.03.09 PM
#Result := #Now.AsCustomDisplayString( "DD/MM/YY" "hh.mm.ss TT" )
This example would produce the output Wednesday, 07 Nov 2012 (17:03)
#Result := #Now.AsCustomDisplayString( "DDDD, DD MMM YYYY" "(H:mm)"  )

See also

All Component Classes

Technical Reference

Febuary 18 V14SP2