cancel
Showing results for 
Search instead for 
Did you mean: 

Changing the date format where month is a string

Former Member
0 Kudos

Hi ,

I need to change the input date format when mapped to target.

My input format is: 10-DEC-2006

The target should be in the format :YYYYMMDD (20061210)

Please suggest whether it is possible using DATE TRANSFORM Function or i need to write an UDF.Request to let me know the UDF code that i can use.

Thanks & Regards,

Yeswanth Raj

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Use Std. fun "DateTrans" Double click and put "dd-MMM-yyyy" in the Format of Source Date and put "yyyyMMdd" Target format.

Regards,

Sarvesh

Answers (6)

Answers (6)

Former Member
0 Kudos

thanks for ur help the date transformation function has worked

markangelo_dihiansan
Active Contributor
0 Kudos

Hi,

You can use this mapping:

Input Date --> toUpperCase --> UDF --> Target

Execution type of the UDF is value, and the name of the argument is a

The content of the UDF is this:

String b=a.substring(3,6);

if (b.equals("JAN")) b= "01";

else if (b.equals("FEB")) b= "02";

else if (b.equals("MAR")) b= "03";

else if (b.equals("APR")) b= "04";

else if (b.equals("MAY")) b= "05";

else if (b.equals("JUN")) b= "06";

else if (b.equals("JUL")) b= "07";

else if (b.equals("AUG")) b= "08";

else if (b.equals("SEP")) b= "09";

else if (b.equals("OCT")) b= "10";

else if (b.equals("NOV")) b= "11";

else b="12";

return (a.substring(7,11)ba.substring(0,2));

hope this helps,

Edited by: Mark Dihiansan on Feb 5, 2009 6:16 AM

Former Member
0 Kudos

Hi,

Use date trans function

Input->TransformDate>Output

Right click on transformDate and change properties

Sourceformat- dd-MMM-yyyy

Targetformat - yyyyMMdd

Former Member
0 Kudos

Hi Yeshwanth,

Get the substring (DEC) from the input date format.

Then use fixValues standard function.In that you define all the 12 months names and their corresponding integer values. After retrieving the value of the month, again concat this with the date and the year and then do date transformation.

I know this is a bit long. But, if you dont want to go for any udf's, i think this would be one of the solutions.

Regards,

Swetha.

Former Member
0 Kudos

Have you tried it. Let us know if face any problems.

Regards,

Sarvesh

Former Member
0 Kudos

Hi,

try this.......use Date transformation.......input format dd-MMM-yyyy and target format yyyyMMdd.

Regards,

Rajeev Gupta

Edited by: RAJEEV GUPTA on Feb 4, 2009 11:55 AM