cancel
Showing results for 
Search instead for 
Did you mean: 

want to change date format

Former Member
0 Kudos

hi Experts,

i need to change date formate from DD/mm/yy to dd.mm.yy can you tel me how can it be done.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Use SimpleDateFormat to achieve this..

Regards,

Vijay.

Former Member
0 Kudos

can you give me some example

"If this is my context ctx_va_bdate of type String (has this to be string only of some thing else)

and i want to change it how can i

if requied format id dd.mm.yy

Former Member
0 Kudos

Hi,

Try the below code...

java.sql.Date sysDate = null; 
String strSysDate = null;	
sysDate = new java.sql.Date(Calendar.getInstance().getTime().getTime());

Calendar cal = Calendar.getInstance();
cal.setTime(sysDate);
int date = cal.get(Calendar.DATE);
int month = cal.get(Calendar.MONTH)+1;
int year = cal.get(Calendar.YEAR);

strSysDate = date+"."+month+"."+year;

Tweeking this can help you get your desired result..

Regards,

Vijay.

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Shankha,

I had also the same problem.. and the solution provided by u was done by me.... bt my problem was not solved... please help....

Thanks ,

Sweta

shankha_saha
Explorer
0 Kudos

Hello Sweta,

I think I am not clear with the exact requirement. Could you please create a new thread in the forum with detailing your requirement. Then other can also suggest you.

Thanks

Shankha

shankha_saha
Explorer
0 Kudos

Hello Prajakta,

You can do it following below simple steps. First create a simple data type of type date in Local Dictionary of your webdynpro application. Then go to the Representation tab of the data type and change the Format to desired format(like dd.MM.yyyy). Then create a context attribute and set the type of this attribute to the simple data type you created before. Now you can assign this context attribute to your UI element(Input field) , run and test the application, value display format will be dd.MM.yyyy

Thanks

Shankha

gautam_singh
Participant
0 Kudos

Hi,

I hope this following example will help you

public class DateFormat

{

public static void main(String[] args)

{

try {

// e.g dd/MM/yy = 13/10/11

SimpleDateFormat fromDateFormat = new SimpleDateFormat("dd/MM/yy");

SimpleDateFormat toDateFormat = new SimpleDateFormat("dd.MM.yy");

Date date = fromDateFormat.parse("13/10/11");

String str = toDateFormat.format(date);

System.out.println(str);

} catch (ParseException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

}

}

Thanks

Gautam Singh