Rocket UniData

2030 is Closer than you think.

  • 1.  2030 is Closer than you think.

    Posted 8 days ago

    Have you thought about changing the CENTURY.PIVOT?

    The century pivot point is the year used to determine the century when an ICONV is done on an external date that only provides a 2 digit year.

    Note the following BASIC code will takes a the date with a 2 digit year, convert it to internal format, then display it in external format.

    >CT BP CPTEST

         CPTEST
    0001 FOR YY = 10 TO 90 STEP 10
    0002 ODATE = "01/01/":YY
    0003 PRINT "TESTING DATE ":ODATE:
    0004 IDATE = ICONV(ODATE, "D2")
    0005 PRINT " --> ":OCONV(IDATE, "D4")
    0006 NEXT YY
     
    >CPTEST
    TESTING DATE 01/01/10 --> 01 JAN 2010
    TESTING DATE 01/01/20 --> 01 JAN 2020
    TESTING DATE 01/01/30 --> 01 JAN 1930
    TESTING DATE 01/01/40 --> 01 JAN 1940
    TESTING DATE 01/01/50 --> 01 JAN 1950
    TESTING DATE 01/01/60 --> 01 JAN 1960
    TESTING DATE 01/01/70 --> 01 JAN 1970
    TESTING DATE 01/01/80 --> 01 JAN 1980
    TESTING DATE 01/01/90 --> 01 JAN 1990

     

    In the above you will notice that two digit years greater than 30 are being treated as if it was 1900 and everything lower than 30 is 2000.  This is because the default CENTURY.PIVOT date is 1930. 

    Note you can check the century pivot point with the CENTURY.PIVOT command at TCL/ECL

     

    >CENTURY.PIVOT

    Century pivot date is 1930

     

    Note you can change the century pivot point for your current session with the CENTURY.PIVOT command, or change it for everyone by changing the configuration file.  (uvconfig for UniData and uvconfig for UniVerse )

     

    Example of changing it at ECL/TCL:

    >CENTURY.PIVOT

    Century pivot date is 1930

    >CENTURY.PIVOT 1950

    Century pivot date is 1950

    >CPTEST

    TESTING DATE 01/01/10 --> 01 JAN 2010
    TESTING DATE 01/01/20 --> 01 JAN 2020
    TESTING DATE 01/01/30 --> 01 JAN 2030
    TESTING DATE 01/01/40 --> 01 JAN 2040
    TESTING DATE 01/01/50 --> 01 JAN 1950
    TESTING DATE 01/01/60 --> 01 JAN 1960
    TESTING DATE 01/01/70 --> 01 JAN 1970
    TESTING DATE 01/01/80 --> 01 JAN 1980
    TESTING DATE 01/01/90 --> 01 JAN 1990

    As you see in the above, we are now seeing the two digit years less than 50 being treated as 2000, and we pivot to 1900 for two digit years of 50 and above.

     

    For more information on the CENTURY.PIVOT command please refer to Rocket Documentation.



    ------------------------------
    Michael Rajkowski
    Rocket Software
    ------------------------------