Hitachi Vantara Pentaho Community Forums
Results 1 to 7 of 7

Thread: Convert String to Date value

  1. #1

    Default Convert String to Date value

    Hi all,

    I new to kettle tool. I want to know how to convert String to Date?

    I need to update :

    String Value :- JUNE 2013
    to Date Value :- 1/6/2013

    How to do it using kettle step.
    Thanks,
    Magesh

    pdi-ce-4.4.0-stable
    java 1.7.0_25 (OpenJDK
    )

  2. #2
    Join Date
    Nov 2013
    Posts
    19

    Default

    If you don't hate coding, you can use a java step.

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

    Default

    The step you are looking for is the Select Values step.
    Don't fill anything in on the first two tabs.
    On the third tab (Metadata) add your column to the grid, change the data type to date, and use the format "MMM yyyy" see http://docs.oracle.com/javase/6/docs...ateFormat.html for more information on the format.
    **THIS IS A SIGNATURE - IT GETS POSTED ON (ALMOST) EVERY POST**
    I'm no expert.
    Take my comments at your own risk.

    PDI user since PDI 3.1
    PDI on Windows 7 & Linux

    Please keep in mind (and this may not apply to this thread):
    No forum member is going to do your work for you. We will help you sort out how to do a specific part of the work, as best we can, in the timelines that our work will allow us.
    Signature Updated: 2014-06-30

  4. #4

    Default

    My output date format look like this format - 1/6/2013.
    Thanks,
    Magesh

    pdi-ce-4.4.0-stable
    java 1.7.0_25 (OpenJDK
    )

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

    Default

    You asked for a String-to-Date conversion, so no output format is involved.

    If you would ask for a Date-To-String conversion we would refer to the same link, probably adding "d/M/yyyy".
    So long, and thanks for all the fish.

  6. #6

    Default

    Quote Originally Posted by marabu View Post
    You asked for a String-to-Date conversion, so no output format is involved.

    If you would ask for a Date-To-String conversion we would refer to the same link, probably adding "d/M/yyyy".
    Please find the sample transformation. am getting error while running the transformation.
    Attached Files Attached Files

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

    Default

    Generally, conversion should be done in the input and output steps.
    Reading the documentation of the SimpleDateFormat, you should see that there is a difference between M, MM, MMM, and MMMM.
    Attached Files Attached Files
    So long, and thanks for all the fish.

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.