Hitachi Vantara Pentaho Community Forums
Results 1 to 4 of 4

Thread: dd-mon-yyyy date input

  1. #1
    Join Date
    Aug 2009
    Posts
    5

    Question dd-mon-yyyy date input

    In a csv, the dates are of format dd-mon-yyyy, like 14-AUG-1947. Oracle accepts these as dates, but in PDI, I have to define them as strings. The problem is I need to do some calculations like Years_of_Service.

    I've searched the documentation, the wiki and the forums, so please forgive me if this has been answered already - it seems pretty basic. I've tried changing the data type to Date, but there are no format masks that recognize this date format. So in Calculator and in Modified java scripts, I can't use datediff calcs, since pdi thinks these dates are strings.

    The only work-arounds I've thought of are to manually code a string manipulation to change the three digit months into two digit months, or to load into a temp table and then do the date calcs with sql.

    Has anyone else already solved this?

    Thanks so much!
    Jan

  2. #2

    Default

    This has been answered before.
    Please look at:
    http://forums.pentaho.org/showthread.php?t=71483

    Carlos Castro

  3. #3
    Join Date
    Nov 1999
    Posts
    9,729

    Default

    The format is

    Code:
    dd-MMM-yyyy
    Please note that this only works if your months are expressed in English and in exactly the right format.

    In that respect, the str2date function in JavaScript accepts a locale function like this:

    Code:
    str2date("22.02.2008 23:23:01","dd.MM.yyyy HH:mm:ss","DE")
    Last edited by MattCasters; 08-10-2009 at 04:46 PM.

  4. #4
    Join Date
    Aug 2009
    Posts
    5

    Default

    Thanks Matt. The format mask is what I needed.

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.