INFORMATICA - Date format conversion

2019-09-21 03:30发布

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 .

标签: informatica
5条回答
仙女界的扛把子
2楼-- · 2019-09-21 04:01

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') 
查看更多
看我几分像从前
3楼-- · 2019-09-21 04:04

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'.

查看更多
疯言疯语
4楼-- · 2019-09-21 04:09

Use the function TO_DATE

TO_DATE(Column_name, 'mm/dd/yyyy')
查看更多
仙女界的扛把子
5楼-- · 2019-09-21 04:09
   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.

查看更多
Juvenile、少年°
6楼-- · 2019-09-21 04:19

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'.

查看更多
登录 后发表回答