Datetime Intrinsic Functions - AsCustomDisplayString Method

Returns the date in a user defined format

Member of Datetime Intrinsic Functions (PRIM_LIBI.IDateTimeIntrinsics)

Parameters

Name

Type

Data Type

Description

Result

*Result (Optional)

String

Resulting custom format string

DateFormat

*Input

String

User defined date format

TimeFormat

*Input

String

User 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 Value

Description

Y

Short year with suppressed leading zero e.g. 4

YY

Short year e.g. 04

YYY

Long year e.g. 2004

M

Short month with suppressed leading zero e.g. 4

MM

Short month e.g. 04

MMM

Abbreviated month e.g. Apr

MMMM

Long month e.g. April

D

Short date with suppressed leading zero e.g. 4

DD

Short date e.g. 04

DDD

Abbreviated date name e.g. Wed

DDDD

Long date name e.g. Wednesday

Time Format

Enum Value

Description

h

12 hour clock with suppressed leading zero e.g. 9

hh

12 hour clock e.g. 09

H

24 hour clock with suppressed leading zero e.g. 9

HH

24 hour clock e.g. 21

m

Minutes with suppressed leading zero e.g. 4

mm

Minutes e.g. 04

s

Seconds with suppressed leading zero e.g. 4

ss

Seconds e.g. 04

f

Milliseconds with suppressed leading zeros e.g. 4

ff

Milliseconds with suppressed leading zeros e.g. 04

fff

Milliseconds e.g. 004

u

Microseconds with suppressed leading zeros e.g. 4

uu

Microseconds with suppressed leading zeros e.g. 04

uuu

Microseconds e.g. 004

n

Nanoseconds with suppressed leading zeros e.g. 4

nn

Nanoseconds with suppressed leading zeros e.g. 04

nnn

Nanoseconds e.g. 004

t

A or P

tt

AM 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

  • No labels