Navigation:  Using > Output Options >

Syntax for Date and Time Information

Previous pageReturn to chapter overviewNext page

The date and time information string can comprise a mix of ordinary characters.

 

The following western formatting character strings can be used in the 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

 

 

Important : if you want to see characters such as dd in the formatted output, placing them in " marks will stop them being interpreted as date or time elements.

 

In addition to this formatting, various of the above options are affected by the following variables, with their default values :

 

DateSeparator  = /

TimeSeparator  = :

ShortDateFormat  = dd/mm/yyyy

LongDateFormat  = dd mmm yyyy

TimeAMString  = AM

TimePMString  = PM

ShortTimeFormat  = hh:mm

LongTimeFormat  = hh:mm:ss

ShortMonthNames  = Jan Feb ...

LongMonthNames  = January, February ...

ShortDayNames  = Sun, Mon ...

LongDayNames  = Sunday, Monday ...

TwoDigitYearCenturyWindow  = 50

 

 

Examples,

 

              d/m/y = 5/6/00

           dd/mm/yy = 05/06/00

  ddd d of mmm yyyy = Mon 5 of Jun 2000

dddd d of mmmm yyyy = Monday 5 of June 2000

              ddddd = 05/06/2000

             dddddd = 05 June 2000

                  c = 05/06/2000 01:02:03

 

 

            h:m:s.z = 1:2:3.4

       hh:mm:ss.zzz = 01:02:03.004

                  t = 01:02

                 tt = 01:02:03

                  c = 05/06/2000 01:02:03

 

 

 

  dd/mm/yy hh:mm:ss = 05/06/49 01:02:03

                mmm = Jun

               mmmm = June

                ddd = Sat

               dddd = Saturday

              ddddd = 05/06/2049

             dddddd = 05 June 2049

             hhampm = 01AM

                  t = 01:02

                 tt = 01:02:03

         dd/mm/yyyy = 05/06/2049