简体   繁体   中英

How to convert following date format into valid date in Informatica?

I am getting date in following format in a flat file. How do I convert into valid date format (YYYY-MM-DD) in Informatica?

Input data:

Jan 4, 2016

Feb 2, 2016

Desired Output :

2016-01-04

2016-02-02

Use this expression in a output column of type String

TO_CHAR(TO_DATE(inputField,'MON DD,YYYY'),'YYYY-MM-DD')

The inner TO_DATE function converts the string 'Jan 4, 2016' to a Date type. Note the format string 'MON DD,YYYY', it is the format in which it is coming from source.

The outer TO_CHAR function converts the Date to a String again in the specified format 'YYYY-MM-DD'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM