Date

Date is a text function that returns the date and time that an online report is populated with data, or the date and time that a snapshot report is saved. The date and time is retrieved from the report server and corresponds to the country where the report server is located. You can use this function in a text box, text cell, or a row or column heading. The function syntax is:

<<Date ("format”,”TimeZoneId”)>>

The following table lists all format date and time characters:

Note:

The date and time format characters are case-sensitive.

Table 40. Date and Time Format Characters  

Format Characters

Meaning

Data Type

Example

G

era designator

text

AD

M

month in year

text or number

If the month is July: M displays: 7 MM displays: 07 MMM displays: Jul MMMM displays: July

d

day in month

number

10

h

hour in am/pm (1-12)

number

11

H

hour in day (0-23)

number

22

m

minute in hour

number

30

s

second in minute

number

25

S

millisecond

number

978

E

day in week

text

E: Tue EE: Tuesday

D

day in year

number

189

F

day of week in month

number

<<Date(“dd-MMM-yy ‘is the’ F 'th ' E 'of' ‘MMM”)>> displays:

24-Dec-02 is the 4th Tue of Dec

w

week in year

number

27

W

week in month

number

2

a

am/pm marker

text

PM

k

hour in day (1-24)

number

23

K

hour in am/pm (0-11)

number

If the time is 3:37PM: 3

z

time zone

text

Pacific Standard Time

y

year

number

2002,02

'

literal text

text

<<Date(“ D’the day of ’yyyy”)>> displays:105th day of 2002

' '

two single quotes to produce one single quote

text

<<Date(“k:mm ‘O’’Clock’ a”)>> displays: 6:15 O’Clock PM

Note:

Use 2 single quotation marks to produce a single quote or an apostrophe as in O’Clock (O’’Clock).

The number or count of format characters determines the exact format:

For example, if the date is April 24:

<<Date("dd-M-yy")>> displays 24-4-02

<<Date("dd-MM-yy”)>> displays 24-04-02

<<Date("dd-MMM-yy")>> displays 24-Apr-02

<<Date("dd-MMMM-yy")>> displays 24-April-02

For numbers, the number of pattern letters is the minimum number of digits. Shorter numbers are padded with zeros. Year is a special case. If you use “yy”, the last two digits of the year are displayed, but if you use “yyyy,” the four-digit year is displayed.

For example, if the month is February:

<<Date("MM-yyyy")>> displays 02-2002

All upper and lower case alphabet characters are considered patterns, regardless of whether they are designated format characters.

If you want literal text, you must enclose that text within single quotes. If you want to use a single quote in literal text, you must enclose the text within single quotes and use two single quotes for the apostrophe.

For example, the format to print 4 o’clock is:

   <<Date("hh 'o''clock' ")>>

Examples:

The following table demonstrates some common date and time format options. Insert any of these in a report in locations that allows text.

Date Format  

Result  

<<Date("d/M/yy")>>

23/3/02

<<Date("d-MMM-yy")>>

23-Mar-02

<<Date("EEEE, MMMM dd, yyyy")>>

Tuesday, March 23, 2002

<<Date("h:mm:ss a")>>

12:52:05 PM

<<Date("h:mm:ss a zzzz")>>

12:52:05 PM Eastern Standard Time

<<Date("EEEE, MMMM dd, yyyy G 'time:' h:mm:ss a zzzz")>>

Tuesday, March 23, 2002 AD time: 12:52:05 PM Eastern Standard Time

<<Date("hh 'o’’clock' a, zzzz")>>

12 O' Clock PM, Eastern Standard Time

Note:

You must use two single quotation marks to produce one single quotation mark in the text of your formatted result.