Retrieving the Current Date or Date-Time Value in Any Valid Format

How to:

Dialogue Manager can return the current date or date and time to a variable in any valid date or date-time format. To return the current date or date-time value to a variable, append the date or date-time format to be returned to &DATE. To suppress trailing blanks, append the format to &DATX.

Note: To remove all punctuation between components, use the variable &YYMD or &DATEHYYMDN. Using the concatenation symbol (|) to remove punctuation between components is not supported.


Top of page

x
Syntax: How to Retrieve the Current Date or Date-Time Value in Any Valid Format
{&DATE|&DATX}fmt

where:

&DATE

Retains trailing blanks in the returned date or date-time value.

&DATX

Suppresses trailing blanks in the returned date or date-time value.

fmt

Is a valid date or date-time format.



Example: Retrieving the Current Date and Date-Time Values

The following procedure retrieves the current date in formats MDYY, YYM, MDY, YYQ, YYMtr (with and without blank suppression), and MBDBYY. It retrieves the current date and time in format HYYMDS:

-TYPE DATE = &DATE
-TYPE MDYY = &DATEMDYY 
-TYPE YYM = &DATEYYM 
-TYPE MDY = &DATEMDY
-TYPE YYQ = &DATEYYQ 
-TYPE MBDBYY = &DATEMBDBYY
-TYPE YYMtr = &DATEYYMtr with blanks and &DATXYYMtr without blanks
-TYPE HYYMDS = &DATEHYYMDS 

The output is:

DATE = 05/09/11
 MDYY = 05/09/2011
 YYM = 2011/05
 MDY = 05/09/11
 YYQ = 2011 Q2
 MBDBYY = 05 09 2011
 YYMtr =  2011, May       with blanks and 2011, May without blanks
 HYYMDS = 2011/05/09 14:06:26

WebFOCUS