Date and Time Parameter Formats

The Executive Server will replace any Parameter beginning with @@DT with the current system date and time.  The format of the date and time is determined by what is entered in the Param Value field of the Parameter Update window.  To use a reserved date/time Parameter, enter a unique name beginning with @@DT in the Param Name field of the Parameter Update window. Enter a description in the Description field.  Then, enter predefined date/time format specifiers (see below) in the Param Value field of the Parameter Update window.  Or, you can create user defined date and time formats (see below) and enter them in the Param Value field.

An example of a predefined date/time Parameter is @@DTpreshort with a value of "d". The Executive Server would replace any @@DTpreshort Parameter with the current time in the format shown in the table below.

An example of a user defined date/time Parameter is @@DTuser with a value of "yyyy-MM-dd". The Executive Server would replace any @@DTuser Parameter with the current date in the format yyyy-MM-dd (e.g., 2016-17-23).

Predefined Date and Time Formats

The following predefined formats can be used in the Param Value field on the Parameter Update window. These predefined formats are dependent on the settings configured under Control Panel: Regional Settings on your system. You can also create user defined date and time formats (see User Defined Date and Time Formats below).

Format specifier Name

Name

Example

d

Sort date pattern

2/17/2015

D

Long date pattern

Tuesday, February 17, 2016

t

Short time pattern

3:34 PM

T

Long time pattern

3:34:47 PM

f

Full date/time pattern (short time)

Tuesday, February 17, 2016 3:34 PM

F

Full date/time pattern (long time)

Tuesday, February 17, 2016 3:34:47 PM

g

General date/time pattern (short time)

2/17/2016 3:34 PM

G

General date/time pattern (long time)

2/17/2016 3:34:47 PM

M or m

Month day pattern

February 17

R or r

RFC1123 pattern

Tue, Feb 2016 15:34:47 GMT

s

Sortable date/time pattern; conforms to ISO 8601

2016-02-17T15:34:47

U

Universal sortable date/time pattern

Tuesday, February 17, 2016 11:34:47 PM

Y or y

Year month pattern

February, 2016

Any other single character

Unknown specifier

 

User Defined Date and Time Formats

You can create your own date/time format and enter it in the Param Value field on the Parameter Update window. Review the following identifiers and examples.

Note: Date separators are dependent on your system's settings under Control Panel: Regional Settings. 

Format Specifier

Description

d

Displays the current day of the month, as a number between 1 and 31. If the day is a single digit only (1-9), then it is displayed as a single digit.

dd

Displays the current day of the month, measured as a number between 1 and 31. If the day is a single digit only (1-9), it is formatted with a preceding 0 (01-09).

ddd

Displays the abbreviated name of the day for the specified DateTime.

dddd (plus any number of additional "d" characters)

Displays the full name of the day for the specified DateTime.

ff up to fffffff

Displays seconds fractions represented in two digits up to seven digits (e.g., fffffff).

g or gg (plus any number of additional "g" characters)

Displays the era (A.D. for example) for the specified DateTime.

h

Displays the hour for the specified DateTime in the range 1-12. The hour represents whole hours passed since either midnight (displayed as 12) or noon (also displayed as 12).

H

Displays the hour for the specified DateTime in the range 0-23. The hour represents whole hours passed since midnight (displayed as 0). If the hour is a single digit (0-9), it is displayed as a single digit.

HH, HH (plus any number of additional "H" characters)

Displays the hour for the specified DateTime in the range 0-23. The hour represents whole hours passed since midnight (displayed as 0). If the hour is a single digit (0-9), it is formatted with a preceding 0 (01-09).

m

Displays the minute for the specified DateTime in the range 0-59. The minute represents whole minutes passed since the last hour. If the minute is a single digit (0-9), it is displayed as a single digit.

mm, mm (plus any number of additional "m" characters)

Displays the minute for the specified DateTime in the range 0-59. The minute represents whole minutes passed since the last hour. If the minute is a single digit (0-9), it is formatted with a preceding 0 (01-09).

M

Displays the month, measured as a number between 1 and 12, inclusive. If the month is a single digit (1-9), it is displayed as a single digit.

MM

Displays the month, measured as a number between 1 and 12, inclusive. If the month is a single digit (1-9), it is displayed as a single digit.

MMM

Displays the abbreviated name of the month for the specified DateTime.

MMMM

Displays the full name of the month for the specified DateTime.

s

Displays the seconds for the specified DateTime in the range 0-59. The second represents whole seconds passed since the last minute. If the second is a single digit (0-9), it is displayed as a single digit only.

ss, ss (plus any number of additional "s" characters)

Displays the seconds for the specified DateTime in the range 0-59. The second represents whole seconds passed since the last minute. If the second is a single digit (0-9), it is formatted with a preceding 0 (01-09).

t

Displays the first character of the A.M./P.M. designator for the specified DateTime.

tt, tt (plus any number of additional "t" characters)

Displays the A.M./P.M. designator for the specified DateTime.

y

Displays the year for the specified DateTime as a maximum two-digit number. The first two digits of the year are omitted. If the year is a single digit (1-9), it is displayed as a single digit.

yy

Displays the year for the specified DateTime as a maximum two-digit number. The first two digits of the year are omitted. If the year is a single digit (1-9), it is formatted with a preceding 0 (01-09).

yyyy

Displays the year for the specified DateTime, including the century. If the year is less than four digits in length, then preceding zeros are appended as necessary to make the displayed year four digits long.

z

Displays the time zone offset for the system's current time zone in whole hours only. The offset is always displayed with a leading sign (zero is displayed as "+0"), indicating hours ahead of Greenwich mean time (+) or hours behind Greenwich mean time (-). The range of values is –12 to +13. If the offset is a single digit (0-9), it is displayed as a single digit with the appropriate leading sign. The setting for the time zone is specified as +X or –X where X is the offset in hours from GMT. The displayed offset is affected by daylight savings time.

zz

Displays the time zone offset for the system's current time zone in whole hours only. The offset is always displayed with a leading or trailing sign (zero is displayed as "+00"), indicating hours ahead of Greenwich mean time (+) or hours behind Greenwich mean time (-). The range of values is –12 to +13. If the offset is a single digit (0-9), it is formatted with a preceding 0 (01-09) with the appropriate leading sign. The setting for the time zone is specified as +X or –X where X is the offset in hours from GMT. The displayed offset is affected by daylight savings time.

zzz, zzz (plus any number of additional "z" characters)

Displays the time zone offset for the system's current time zone in hours and minutes. The offset is always displayed with a leading or trailing sign (zero is displayed as "+00:00"), indicating hours ahead of Greenwich mean time (+) or hours behind Greenwich mean time (-). The range of values is –12:00 to +13:00. If the offset is a single digit (0-9), it is formatted with a preceding 0 (01-09) with the appropriate leading sign. The setting for the time zone is specified as +X or –X where X is the offset in hours from GMT. The displayed offset is affected by daylight savings time.

:

Time separator.

/

Date separator.

"

Quoted string. Displays the literal value of any string between two quotation marks preceded by the escape character (/).

'

Quoted string. Displays the literal value of any string between two " ' " characters.

%c

Where c is both a standard format specifier and a custom format specifier, displays the custom format pattern associated with the format specifier.

\c

Where c is any character, the escape character displays the next character as a literal. The escape character cannot be used to create an escape sequence (like "\n" for new line) in this context.

Any other character

Other characters are written directly to the result string as literals.

Examples

yyyy-MM-dd 2016-02-18

hh:mm:ss 12:23:53

hh:mm tt 12:23 PM

Date Calculations

You can pass a calculated date value from a Parameter using the Format as DateTimeCalcDays option and Validate as DateTime on the Parameter properties window.  For example, you want to pass in a value of 30 days prior to today as shown in the following dialog:

Note:  the vertical bar between the date format and the number of days to add or subtract.  Use can use a negative number to subtract days or a positive number.  For a positive number do not use the "+" symbol.

The general syntax for the value field is:

<dateFormatSpecifier>|<num>

where

<dateFormatSpecifier> is any valid date format.

<num> is a negative or positive integer.