xcall GRECNV, dblock
GRECNV takes an input date and converts it to a variety of other formats (String, Gregorian, separated) with optional range and validity checking. The type of conversion is specified by the PCONC field.
MAP1 DBLOCK
MAP2 PSTR,S,12 ! MM/DD/YY or MM/DD/CCYY
MAP2 PYEAR,B,2 ! Year in Century
MAP2 PMON,B,1 ! Month
MAP2 PDAY,B,1 ! Day
MAP2 PCENT,B,2 ! Century
MAP2 PBASE,B,4 ! New – Zero for Gregorian date
MAP2 PJDAT,B,5 ! Gregorian form of the date
MAP2 PCONC,S,1 ! Conversion request code
! "D" = Start with string (PSTR)
! "G" = Start with Gregorian (PJDAT)
! "M" = Start with separated
(PYEAR,PMON,PDAY,PCENT)
! "T" = Start with today
MAP2 PVALD,S,1 ! To-Gregorian validity checking
! "N" = Do not do reverse conversion check
MAP2 PFRMT,S,1 ! Date format code
! "C" = MM-DD-YYYY (Yr+Cent*100)
! "S" = MM-DD-YY-CCCC (Sep Century)
MAP2 PCMPC,S,1 ! Completion code
! "S" = Success
! "R" = Success but out of range
! "U" = Failure
MAP2 PDOW,B,1 ! Day of week (0=Monday)
MAP2 POLD,B,5 ! Oldest date within range
MAP2 PRNGE,S,1 ! Range check code
! "B" = Date must be BC
! "A" = Date must be AD
! "R" = Date must be within old/new range
MAP2 PNEW,B,5 ! Newest date within range
MAP2 PFIL,B,5 ! Not used
GRECNV was originally written for AMOS by Bob Strunk of Software Systems Consulting in Cincinnati, Ohio, and may be still available if you are looking for a date conversion routine that is available on both AMOS and A-Shell.