Trail: PROIV Documentation > Developer > PROIV Developer > Developing Functions > Events and Logic > CDATE

 

 

Purpose

CDATE converts dates from alphanumeric to numeric, or vice versa, with or without formatting.
 

Syntax

variable = CDATE(alpha-date{,mask})
or
variable =
CDATE(numeric-date{,mask})
 

Operation

alpha-date is a valid alphanumeric literal, variable, or expression, in the format YYYYMMDD or the format specified by the mask.

numeric-date
 
is a valid numeric constant, variable, or expression representing the number of days since December 31, 1799.

mask
 is an alphanumeric variable or literal which contains key characters to define the format of the input alpha-date, or the output alphanumeric variable for the numeric-date.  
Valid components of the mask are shown below. 

Remarks

Setting the environment variable CDATE_50=Y causes CDATE to use the '50-year Rule' for two-digit years.

"Fill" characters for the formatted date, include

blank
slash (/)
period (.)
comma (,)
dash (-)

D..... .is the full name for the day (e.g. SUNDAY) up to a maximum of nine characters.
DD... .is the two-digit day of the month (01 to 31) in alphanumeric format.
DDD...is the three-character name for the day of the week (e.g. SUN).
M.......is the full name of the month (e.g. JANUARY) up to a maximum of nine characters.
MM.....is the two-digit code for the month (01 to 12).
MMM.. is the three-character name for the month (e.g. JAN).
YY..... is the last two digits of the year, in alphanumeric format.
YYYY...is the full four-digit year(1800 to 2199)
 

Example

Assume that:
#DATE1 =67630
$DATE2 =19850227’
$MASK1=’M DD,YYYY’
$DATE3 =’02/28/85’
$MASK2=’MM/DD/YY’
$DATE4 =’FEB 27, 1985’

Format                                                             Result

$DATE5 = CDATE(#DATE1)................................‘19850301’
#DATE6 = CDATE($DATE2).................................67628
$DATE7 = CDATE(#DATE1,$MASK1)...................‘MARCH 01,1985’
#DATE8 = CDATE($DATE3,$MASK2) ...................67629
#DATE9 = CDATE($DATE4,’MMM DD, YYYY’) ........67628
 

Comment on this topic

Topic ID: 520028

Table of Contents

Index

Glossary

-Search-

Back