cancel
Showing results for 
Search instead for 
Did you mean: 

Date format dd-MMM-yyyy

Former Member
0 Kudos

Hi Friends,

I would be getting the date format in yyyyMMdd and i have to display it in dd-MMM-yyyy.

I could not see suck option in 'date trans' function.

Could some one shed somelight on this.

Accepted Solutions (0)

Answers (6)

Answers (6)

Former Member
0 Kudos

In Date Function, Select DateTrans --->Properties.

The Formats of Source and Target Date are editable and allows to manually enter the required format. Format of Source Date : select and edit to yyyyMMdd and Format of Target Date : select and edit to dd-MMM-yyyy. Now test in the Test Tab in MM.

Former Member
0 Kudos

Solved

Former Member
0 Kudos

Hi...

You can get the output format of your date by using the DateTrans function.

Do as specified by Venkateswarulu.

Regards,

Leela

Former Member
0 Kudos

public String dateFormat(String date, Container container) { // date = yyyyMMdd convert to dd-MMM-yyyy

if (date.length() > 0 ) {

String [] month = {"JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC"};

char charArray[] = date.toCharArray();

StringBuffer targetDate = new StringBuffer();

targetDate.append(date.substring(6));

targetDate.append("-");

targetDate.append(month[Integer.parseInt(date.copyValueOfcharArray,4,2),10) - 1]);

targetDate.append("-");

targetDate.append( date.substring(0,4));

return targetDate.toString();

}

return "";

}

Former Member
0 Kudos

Create the Simple UDF and use the below code:

public String dateFormat(String date, Container container) { // date = yyyyMMdd convert to dd-MMM-yyyy

if (date.length() > 0 ) {

String [] month = {"JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC"};

char charArray[] = date.toCharArray();

StringBuffer targetDate = new StringBuffer();

targetDate.append(date.substring(6));

targetDate.append("-");

targetDate.append(month[Integer.parseInt(date.copyValueOf(charArray,4,2),10) - 1]);

targetDate.append("-");

targetDate.append( date.substring(0,4));

return targetDate.toString();

}

return "";

}

Former Member
0 Kudos

Hi,

You can maually enter date format of u r Source and Target using Datetran Standard Fuction

Just Type

yyyyMMdd --- > dd-MMM-yyyy.

it will work

Srini

prateek
Active Contributor
0 Kudos

I guess dateTrans should solve your problem. Are you checking for the possibilities in drop down? Try to manually input the source and target format and test it.

Regards,

Prateek