INFORMATICA - Date format conversion

随声附和 提交于 2019-12-13 11:07:56

问题


Hello guys i have a date format of 12/05/2015 i.e., dd/mm/yyyy . I need to convert this as 05/12/2015 i.e., mm/dd/yyyy . Can any one give me a solution .


回答1:


Because function TO_DATE by default expects the date as a char value to be in the form 'MM/DD/YYYY', you need to specify you're handing it in as 'DD/MM/YYYY'. Then you want the final output to be a string (presumably) in format 'MM/DD/YYYY', so for that you need the function TO_CHAR. So you have to jump that hurdle, too. The final statement for your example, then, looks like this:

TO_CHAR(TO_DATE('12/05/2015', 'DD/MM/YYYY'), 'MM/DD/YYYY')

The output will be '05/12/2015'.




回答2:


Use the function TO_DATE

TO_DATE(Column_name, 'mm/dd/yyyy')



回答3:


In informatica Help file, There is a chapter called "functions". In that check TO_DATE function.

TO_DATE( string [, format] )

String ---- Must be a string datatype. Passes the values that you want to convert to dates. You can enter any valid transformation expression.

format ---- Enter a valid TO_DATE format string. The format string must match the parts of the string argument. For example, if you pass the string '20150515', you must use the format string 'YYYYMMDD'.




回答4:


   v_PORT(DataType-DateTime)-TO_DATE(TO_CHAR(INPUTPORT),'DD/MM/YYYY')
   o_PORT(String)--TO_CHAR(v_PORT,'MM/DD/YYYY')

It will work.




回答5:


Use the below command, this will give you the value as per you requirement

TO_CHAR(TO_DATE(Column, 'DD/MM/YYYY'), 'MM/DD/YYYY') 


来源:https://stackoverflow.com/questions/30182784/informatica-date-format-conversion

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!