New $Days Function Creates ASK Dates

The latest pre-release version of Suprtool has a new conversion routine that converts dates to a Julian date number (where 1 = Jan. 1, 4713 BC). Because ASK dates are also a form of Julian dates (based on Nov. 1, 1971) it is possible to create ASK dates in a couple of steps.

The example below converts a file of ccyymmdd dates to Julian dates, then subtracts the constant between ASK and Julian dates. The third step is just a "proof" step that converts the ASK dates back to ccyymmdd dates to show that they are equal to the original file's dates.

    in   myfile
    def  cymd,1,8,display
    item cymd,date,ccyymmdd
    def  juldays,1,4,integer
    ext  cymd, juldays = $days(cymd)
    out  myfile2,link,temp
    IN=3, OUT=3. CPU-Sec=1. Wall-Sec=1.

    in   myfile2
    def  askdate,1,2,integer
    ext  askdate = juldays - 2441255
    ext  cymd, juldays
    out  myfile3,link,temp
    IN=3, OUT=3. CPU-Sec=1. Wall-Sec=1.

    in myfile3
    item askdate,date,ask
    def  newdate,1,8,display
    ext  newdate=$stddate(askdate)
    ext  cymd,juldays,askdate
    list standard
    Jul 29, 1999  9:56        File: MYFILE3         Page 1


    19990729  19990729     2451389  10134
    19730101  19730101     2441684    429
    20000101  20000101     2451545  10290
    IN=3, OUT=3. CPU-Sec=1. Wall-Sec=1.

[Paul Gobes]

....Back to the Suprtool Q&A Page