Hitachi Vantara Pentaho Community Forums
Results 1 to 4 of 4

Thread: Select value metadata change gives wrong result.

  1. #1
    Join Date
    Dec 2016
    Posts
    17

    Default Select value metadata change gives wrong result.

    i have input date like dd/mm/yy e.g 02/02/48 while im converting this to dd/mm/yyyy format using select value step it is giving 02/02/1948 which is wrong.
    how I can make it like 02/02/2048.

  2. #2
    Join Date
    Aug 2016
    Posts
    290

    Default

    How can a machine know that 1948 is wrong? If your input data doesn't contain enough information to understand what the year is, you should modify the years before or after converting the to date data type.

    using yy instead of yyyy is ambiguous, which is why it is almost never used!

  3. #3
    Join Date
    Dec 2016
    Posts
    17

    Default

    Than how this step is converting eg 02/02/36 to 02/02/2036 which is correct and not 02/02/1936.

  4. #4
    Join Date
    Apr 2008
    Posts
    4,696

    Default

    From the Java Documentation (https://docs.oracle.com/javase/6/doc...ateFormat.html ):


    • For parsing with the abbreviated year pattern ("y" or "yy"), SimpleDateFormat must interpret the abbreviated year relative to some century. It does this by adjusting dates to be within 80 years before and 20 years after the time the SimpleDateFormat instance is created. For example, using a pattern of "MM/dd/yy" and a SimpleDateFormat instance created on Jan 1, 1997, the string "01/11/12" would be interpreted as Jan 11, 2012 while the string "05/04/64" would be interpreted as May 4, 1964. During parsing, only strings consisting of exactly two digits, as defined by Character.isDigit(char), will be parsed into the default century. Any other numeric string, such as a one digit string, a three or more digit string, or a two digit string that isn't all digits (for example, "-1"), is interpreted literally. So "01/02/3" or "01/02/003" are parsed, using the same pattern, as Jan 2, 3 AD. Likewise, "01/02/-3" is parsed as Jan 2, 4 BC.




    2018 - 80 = 1938. So any two digit year less than 38 will be interpreted as being in the future. (36 -> 2036)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Privacy Policy | Legal Notices | Safe Harbor Privacy Policy

Copyright © 2005 - 2019 Hitachi Vantara Corporation. All Rights Reserved.