Hitachi Vantara Pentaho Community Forums
Results 1 to 6 of 6

Thread: Padding year

  1. #1
    Join Date
    Sep 2011
    Posts
    171

    Default Padding year

    Hello Everyone,

    I have data in the format "01/17/11" and I would like to convert it to format "01/17/2011". I read date as a string and cut necessary digits. I tried to pad year "11" with "20", but padding did not work.

    Could you give me an idea what I have done wrong?

    Regards,
    august_month
    Attached Files Attached Files

  2. #2
    Join Date
    Jun 2012
    Posts
    5,534

    Default

    There is a samples folder coming with Kettle.
    Have a look at "CSV Input - Reading customer data" and learn about SimpleDateFormat.
    So long, and thanks for all the fish.

  3. #3
    Join Date
    Sep 2011
    Posts
    171

    Default

    Thank you, marabu!

    I looked at example and I do not think it applies to me. My year is in the form "11", there is no way for PDI to know whether it is "1911" or "2011", so I guess I have to analyze it manually.

    I seem to be not using padding correctly. Any guesses what I did wrong with padding?

    Regards,
    august_month

  4. #4
    Join Date
    Jun 2012
    Posts
    5,534

    Default

    Believe me, it's mostly Java and the SimpleDateFormat.
    Attached Files Attached Files
    So long, and thanks for all the fish.

  5. #5
    Join Date
    Dec 2011
    Posts
    12

    Default

    August_month,

    Either use the step Calculator and concatenate the string "20" with your field [YearDate], or use the step Modified Java Script Value to do the same.

  6. #6
    Join Date
    Sep 2011
    Posts
    171

    Default

    Thank you, marabu and yacno!

    marabu was right. I did not expect that different centuries are accommodated in a such a way.

    I have not thought about using Calculator to this task. I ended up using Modified Java Script Value, but I will probably revert to marabu suggestion.

    By the way padding still is not working, probably I am missing something.

    Thank you, All!

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.