Return to the RPG Tips
Date Conversion Chart using /Free
Found on the following list:
http://groups.yahoo.com/group/RPGIV/
********************************************************************** * character dates d @chara s 8 inz('04/12/01') d @charb s 10 inz('12/02/2004') d @charc s 8 inz('12/03/04') ********************************************************************** * date field d @datea s d inz(d'2004-12-04') ********************************************************************** * numeric dates d @numa s 6 0 inz(041205) d @numb s 7 0 inz(1041206) d @numc s 8 0 inz(20041207) d @numd s 6 0 inz(120804) d @nume s 8 0 inz(12092004) ********************************************************************** /free //character to character... @charb = %char(%date(@chara:*ymd/):*usa/); //'yy/mm/dd' to 'mm/dd/ccyy' @charc = %char(%date(@chara:*ymd/):*mdy/); //'yy/mm/dd' to 'mm/dd/yy' @chara = %char(%date(@charb:*usa/):*ymd/); //'mm/dd/ccyy' to 'yy/mm/dd' @charc = %char(%date(@charb:*usa/):*mdy/); //'mm/dd/ccyy' to 'mm/dd/yy' @chara = %char(%date(@charc:*mdy/):*ymd/); //'mm/dd/yy' to 'yy/mm/dd' @charb = %char(%date(@charc:*mdy/):*usa/); //'mm/dd/yy' to 'mm/dd/ccyy' //character to numeric... @numa = %dec(%char(%date(@chara:*ymd/):*ymd0):6:0); //'yy/mm/dd' to yymmdd @numb = %dec(%char(%date(@chara:*ymd/):*cymd0):7:0); //'yy/mm/dd' to cyymmdd @numd = %dec(%char(%date(@chara:*ymd/):*mdy0):7:0); //'yy/mm/dd' to mmddyy @numa = %dec(%char(%date(@charb:*usa/):*ymd0):6:0); //'mm/dd/ccyy' to yymmdd @numb = %dec(%char(%date(@charb:*usa/):*cymd0):7:0); //'mm/dd/ccyy' to cyymmdd @numd = %dec(%char(%date(@charb:*usa/):*mdy0):7:0); //'mm/dd/ccyy' to mmddyy @numa = %dec(%char(%date(@charc:*mdy/):*ymd0):6:0); //'mm/dd/yy' to yymmdd @numb = %dec(%char(%date(@charc:*mdy/):*cymd0):7:0); //'mm/dd/yy' to cyymmdd @numd = %dec(%char(%date(@charc:*mdy/):*mdy0):7:0); //'mm/dd/yy' to mmddyy //date to character... @chara = %char(@datea:*ymd/); //d'ccyy-mm-dd' to 'yy/mm/dd' @charb = %char(@datea:*usa/); //d'ccyy-mm-dd' to 'mm/dd/ccyy' @charc = %char(@datea:*mdy/); //d'ccyy-mm-dd' to 'mm/dd/yy' //numeric to character... @chara = %char(%date(@numa:*ymd):*ymd/); //yymmdd to 'yy/mm/dd' @charb = %char(%date(@numa:*ymd):*usa/); //yymmdd to 'mm/dd/ccyy' @charc = %char(%date(@numa:*ymd):*mdy/); //yymmdd to 'mm/dd/yy' @chara = %char(%date(@numb:*cymd):*ymd/); //cyymmdd to 'yy/mm/dd' @charb = %char(%date(@numb:*cymd):*usa/); //cyymmdd to 'mm/dd/ccyy' @charc = %char(%date(@numb:*cymd):*mdy/); //cyymmdd to 'mm/dd/yy' @chara = %char(%date(@numc:*iso):*ymd/); //d'ccyy-mm-dd' to 'yy/mm/dd' @charb = %char(%date(@numc:*iso):*usa/); //d'ccyy-mm-dd' to 'mm/dd/ccyy' @charc = %char(%date(@numc:*iso):*mdy/); //d'ccyy-mm-dd' to 'mm/dd/yy' @chara = %char(%date(@numd:*mdy):*ymd/); //mmddyy to 'yy/mm/dd' @charb = %char(%date(@numd:*mdy):*usa/); //mmddyy to 'mm/dd/ccyy' @charc = %char(%date(@numd:*mdy):*mdy/); //mmddyy to 'mm/dd/yy' @chara = %char(%date(@nume:*usa):*ymd/); //mmddccyy to 'yy/mm/dd' @charb = %char(%date(@nume:*usa):*usa/); //mmddccyy to 'mm/dd/ccyy' @charc = %char(%date(@nume:*usa):*mdy/); //mmddccyy to 'mm/dd/yy' //numeric to date... @datea = %date(@numa:*ymd); //yymmdd to d'ccyy-mm-dd' @datea = %date(@numb:*cymd); //cyymmdd to d'ccyy-mm-dd' @datea = %date(@numc:*iso); //ccyymmdd' to d'ccyy-mm-dd' @datea = %date(@numd:*mdy); //mmddyy to d'ccyy-mm-dd' @datea = %date(@nume:*usa); //mmddccyy to d'ccyy-mm-dd' //numeric to numeric... @numb = %dec(%char(%date(@numa:*ymd):*cymd0):7:0); //yymmdd to cyymmdd @numc = %dec(%char(%date(@numa:*ymd):*iso0):8:0); //yymmdd to ccyymmdd @numd = %dec(%char(%date(@numa:*ymd):*mdy0):6:0); //yymmdd to mmddyy @nume = %dec(%char(%date(@numa:*ymd):*usa0):8:0); //yymmdd to mmddccyy @numa = %dec(%char(%date(@numb:*cymd):*ymd0):6:0); //cyymmdd to yymmdd @numc = %dec(%char(%date(@numb:*cymd):*iso0):8:0); //cyymmdd to ccyymmdd @numd = %dec(%char(%date(@numb:*cymd):*mdy0):6:0); //cyymmdd to mmddyy @nume = %dec(%char(%date(@numb:*cymd):*usa0):8:0); //cyymmdd to mmddccyy @numa = %dec(%char(%date(@numc:*iso):*ymd0):6:0); //ccyymmdd to yymmdd @numb = %dec(%char(%date(@numc:*iso):*cymd0):7:0); //ccyymmdd to cyymmdd @numd = %dec(%char(%date(@numc:*iso):*mdy0):6:0); //ccyymmdd to mmddyy @nume = %dec(%char(%date(@numc:*iso):*usa0):8:0); //ccyymmdd to mmddccyy @numa = %dec(%char(%date(@numd:*mdy):*ymd0):6:0); //mmddyy to yymmdd @numb = %dec(%char(%date(@numd:*mdy):*cymd0):7:0); //mmddyy to cyymmdd @numc = %dec(%char(%date(@numd:*mdy):*iso0):8:0); //mmddyy to ccyymmdd @nume = %dec(%char(%date(@numd:*mdy):*usa0):8:0); //mmddyy to mmddccyy @numa = %dec(%char(%date(@nume:*usa):*ymd0):6:0); //mmddccyy to yymmdd @numb = %dec(%char(%date(@nume:*usa):*cymd0):7:0); //mmddccyy to cyymmdd @numc = %dec(%char(%date(@nume:*usa):*iso0):8:0); //mmddccyy to ccyymmdd @numd = %dec(%char(%date(@nume:*usa):*mdy0):6:0); //mmddccyy to mmddyy *inlr = *on; /end-free
[report a broken link by clicking here]