Search code examples
csvtalend

Extract date from a string using Talend


I am receiving CSV files daily which have header like "AD PERFORMANCE REPORT (Jan 24, 2016)". I would like to extract date from it and use it as date column using Talend. How can I do that?


Solution

  • For change the format of a specicif column in other format, you can use the "tExtractRegexFields", with your regex for get just your date.

    tFileInputDelimited --> tExtractRegexFields --> tMap --> tFileOutputDelimited
    

    After get the date in your string with the 'tExtractRegexFields' component, you can specifyy the type of date in your output Schema like that :

    enter image description here

    the pattern of your date (Jan 24, 2016) is "MMM d, yyyy"

    link for tExtractRegexField on Talend is here

    link for a great website for test your regex is here

    link for date Pattern in Jav is here