%DATE BIF

%DATE{(expression{:date-format})}

%DATE- converts the value of the expression from character, numeric, or timestamp data to type date. The converted value remains unchanged, but is returned as a date.

Date Formats

2-Digit Year Formats 
Format Default
name *LOVAL *HIVAL Value
*MDY 01/01/40 12/31/39 01/01/40
*DMY 01/01/40 31/12/39 01/01/40
*YMD 40/01/01 39/12/31 40/01/01
*JUL 40/001 39/365 40/001

4-Digit Year Formats
Format Default
name *LOVAL *HIVAL Value
*ISO 0001-01-01 9999-12-31 0001-01-01
*USA 01/01/0001 12/31/9999 01/01/0001
*EUR 01.01.0001 31.12.9999 01.01.0001
*JIS 0001-01-01 9999-12-31 0001-01-01


D Date s d
/free
Date = %date(122507: *MDY);
Date = %date(251207: *DMY);
Date = %date(071225: *YMD);
Date = %date(12252007: *USA);
Date = %date(25122007: *EUR);
Date = %date(20071225: *ISO);

Date = %date('122507': *MDY0);
Date = %date('251207': *DMY0);
Date = %date('071225': *YMD0);
Date = %date('12252007': *USA0);
Date = %date('25122007': *EUR0);
Date = %date('20071225': *ISO0);

Date = %date('12/25/07': *MDY);
Date = %date('25/12/07': *DMY);
Date = %date('07/12/25': *YMD);
Date = %date('12/25/2007': *USA);
Date = %date('25.12.2007': *EUR);
Date = %date('2007-12-25': *ISO);
/end-free

Other BIFs Used with Date Fields


*...1....+....2....+....3....+....4....+....5....+....6....+....7...+....
/FREE
// Determine the date in 3 years
newdate = date + %YEARS(3);

// Determine the date in 6 months prior
loandate = duedate - %MONTHS(6);

// Construct a timestamp from a date and time
duestamp = duedate + t’12.00.00’;
/END-FREE

Blog Archive