H option(*nodebugio) D stringA S 8 inz('04/12/01') D stringB S 10 inz('12/02/2004') D stringC S 8 inz('12/03/04') D DateTypeA S d inz(D'2004-12-04') D integerA S 6 0 inz(041205) D integerB S 7 0 inz(1041206) D ORDATE S 8 0 inz(20041207) D integerD S 6 0 inz(120804) D integerE S 8 0 inz(12092004) /free // String to String... stringB = %char(%date(stringA:*ymd/):*usa/); // 'yy/mm/dd' to 'mm/dd/ccyy' stringC = %char(%date(stringA:*ymd/):*mdy/); // 'yy/mm/dd' to 'mm/dd/yy' stringA = %char(%date(stringB:*usa/):*ymd/); // 'mm/dd/ccyy' to 'yy/mm/dd' stringC = %char(%date(stringB:*usa/):*mdy/); // 'mm/dd/ccyy' to 'mm/dd/yy' stringA = %char(%date(stringC:*mdy/):*ymd/); // 'mm/dd/yy' to 'yy/mm/dd' stringB = %char(%date(stringC:*mdy/):*usa/); // 'mm/dd/yy' to 'mm/dd/ccyy' // String to date... DateTypeA = %date(stringA:*ymd/); // 'yy/mm/dd' to D'ccyy-mm-dd' DateTypeA = %date(stringB:*usa/); // 'mm/dd/ccyy' to D'ccyy-mm-dd' DateTypeA = %date(stringC:*mdy/); // 'mm/dd/yy' to D'ccyy-mm-dd' // String to Integer ... integerA = %dec(%char(%date(stringA:*ymd/):*ymd0):6:0); // 'yy/mm/dd' to yymmdd integerB = %dec(%char(%date(stringA:*ymd/):*cymd0):7:0); // 'yy/mm/dd' to cyymmdd ORDATE = %dec(%char(%date(stringA:*ymd/):*iso0):7:0); // 'yy/mm/dd' to ccyymmdd integerD = %dec(%char(%date(stringA:*ymd/):*mdy0):7:0); // 'yy/mm/dd' to mmddyy integerE = %dec(%char(%date(stringA:*ymd/):*usa0):7:0); // 'yy/mm/dd' to mmddyyyy integerA = %dec(%char(%date(stringB:*usa/):*ymd0):6:0); // 'mm/dd/ccyy' to yymmdd integerB = %dec(%char(%date(stringB:*usa/):*cymd0):7:0); // 'mm/dd/ccyy' to cyymmdd ORDATE = %dec(%char(%date(stringB:*usa/):*iso0):7:0); // 'mm/dd/ccyy' to ccyymmdd integerD = %dec(%char(%date(stringB:*usa/):*mdy0):7:0); // 'mm/dd/ccyy' to mmddyy integerE = %dec(%char(%date(stringB:*usa/):*usa0):7:0); // 'mm/dd/ccyy' to mmddyyyy integerA = %dec(%char(%date(stringC:*mdy/):*ymd0):6:0); // 'mm/dd/yy' to yymmdd integerB = %dec(%char(%date(stringC:*mdy/):*cymd0):7:0); // 'mm/dd/yy' to cyymmdd ORDATE = %dec(%char(%date(stringC:*mdy/):*iso0):7:0); // 'mm/dd/yy' to ccyymmdd integerD = %dec(%char(%date(stringC:*mdy/):*mdy0):7:0); // 'mm/dd/yy' to mmddyy integerE = %dec(%char(%date(stringC:*mdy/):*usa0):7:0); // 'mm/dd/yy' to mmddyyyy // date to String... stringA = %char(DateTypeA:*ymd/); // D'ccyy-mm-dd' to 'yy/mm/dd' stringB = %char(DateTypeA:*usa/); // D'ccyy-mm-dd' to 'mm/dd/ccyy' stringC = %char(DateTypeA:*mdy/); // D'ccyy-mm-dd' to 'mm/dd/yy' // date to Integer ... integerA = %dec(%char(DateTypeA:*ymd/):6:0); // D'ccyy-mm-dd' to yymmdd integerB = %dec(%char(DateTypeA:*cymd/):7:0); // D'ccyy-mm-dd' to cyymmdd ORDATE = %dec(%char(DateTypeA:*iso-):8:0); // D'ccyy-mm-dd' to ccyymmdd integerD = %dec(%char(DateTypeA:*mdy/):6:0); // D'ccyy-mm-dd' to mmddyy integerE = %dec(%char(DateTypeA:*usa/):8:0); // D'ccyy-mm-dd' to mmddccyy // Integer to String... stringA = %char(%date(integerA:*ymd):*ymd/); // yymmdd to 'yy/mm/dd' stringB = %char(%date(integerA:*ymd):*usa/); // yymmdd to 'mm/dd/ccyy' stringC = %char(%date(integerA:*ymd):*mdy/); // yymmdd to 'mm/dd/yy' stringA = %char(%date(integerB:*cymd):*ymd/); // cyymmdd to 'yy/mm/dd' stringB = %char(%date(integerB:*cymd):*usa/); // cyymmdd to 'mm/dd/ccyy' stringC = %char(%date(integerB:*cymd):*mdy/); // cyymmdd to 'mm/dd/yy' stringA = %char(%date(ORDATE:*iso):*ymd/); // D'ccyy-mm-dd' to 'yy/mm/dd' stringB = %char(%date(ORDATE:*iso):*usa/); // D'ccyy-mm-dd' to 'mm/dd/ccyy' stringC = %char(%date(ORDATE:*iso):*mdy/); // D'ccyy-mm-dd' to 'mm/dd/yy' stringA = %char(%date(integerD:*mdy):*ymd/); // mmddyy to 'yy/mm/dd' stringB = %char(%date(integerD:*mdy):*usa/); // mmddyy to 'mm/dd/ccyy' stringC = %char(%date(integerD:*mdy):*mdy/); // mmddyy to 'mm/dd/yy' stringA = %char(%date(integerE:*usa):*ymd/); // mmddccyy to 'yy/mm/dd' stringB = %char(%date(integerE:*usa):*usa/); // mmddccyy to 'mm/dd/ccyy' stringC = %char(%date(integerE:*usa):*mdy/); // mmddccyy to 'mm/dd/yy' // Integer to date... DateTypeA = %date(integerA:*ymd); // yymmdd to D'ccyy-mm-dd' DateTypeA = %date(integerB:*cymd); // cyymmdd to D'ccyy-mm-dd' DateTypeA = %date(ORDATE:*iso); // ccyymmdd' to D'ccyy-mm-dd' DateTypeA = %date(integerD:*mdy); // mmddyy to D'ccyy-mm-dd' DateTypeA = %date(integerE:*usa); // mmddccyy to D'ccyy-mm-dd' // Integer to Integer ... integerB = %dec(%char(%date(integerA:*ymd):*cymd0):7:0); // yymmdd to cyymmdd ORDATE = %dec(%char(%date(integerA:*ymd):*iso0):8:0); // yymmdd to ccyymmdd integerD = %dec(%char(%date(integerA:*ymd):*mdy0):6:0); // yymmdd to mmddyy integerE = %dec(%char(%date(integerA:*ymd):*usa0):8:0); // yymmdd to mmddccyy integerA = %dec(%char(%date(integerB:*cymd):*ymd0):6:0); // cyymmdd to yymmdd ORDATE = %dec(%char(%date(integerB:*cymd):*iso0):8:0); // cyymmdd to ccyymmdd integerD = %dec(%char(%date(integerB:*cymd):*mdy0):6:0); // cyymmdd to mmddyy integerE = %dec(%char(%date(integerB:*cymd):*usa0):8:0); // cyymmdd to mmddccyy integerA = %dec(%char(%date(ORDATE:*iso):*ymd0):6:0); // ccyymmdd to yymmdd integerB = %dec(%char(%date(ORDATE:*iso):*cymd0):7:0); // ccyymmdd to cyymmdd integerD = %dec(%char(%date(ORDATE:*iso):*mdy0):6:0); // ccyymmdd to mmddyy integerE = %dec(%char(%date(ORDATE:*iso):*usa0):8:0); // ccyymmdd to mmddccyy integerA = %dec(%char(%date(integerD:*mdy):*ymd0):6:0); // mmddyy to yymmdd integerB = %dec(%char(%date(integerD:*mdy):*cymd0):7:0); // mmddyy to cyymmdd ORDATE = %dec(%char(%date(integerD:*mdy):*iso0):8:0); // mmddyy to ccyymmdd integerE = %dec(%char(%date(integerD:*mdy):*usa0):8:0); // mmddyy to mmddccyy integerA = %dec(%char(%date(integerE:*usa):*ymd0):6:0); // mmddccyy to yymmdd integerB = %dec(%char(%date(integerE:*usa):*cymd0):7:0); // mmddccyy to cyymmdd ORDATE = %dec(%char(%date(integerE:*usa):*iso0):8:0); // mmddccyy to ccyymmdd integerD = %dec(%char(%date(integerE:*usa):*mdy0):6:0); // mmddccyy to mmddyy *inlr = *on; /end-free