Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

How to get a date picker according to the language?

Hi All,

I want to have adate picker according to the language selected.

Can any one of you help me in doing this.



Former Member
Former Member replied

Hi DK,

I Don't think that you can change your Date format to the selected Country format.

DatePicker will take the format of the browser language Settings.

I tried using the below code. Still it will take Browser Language Settings.

String usFormat = "MM/dd/yyyy";
String ukFormat = "dd/MM/yyyy";
Date date = wdContext.currentContextElement().getTest2();
SimpleDateFormat simpD= null;
int dateOfMonth=date.getDate();
int month = date.getMonth()+1;
int year = date.getYear()+1900;
java.util.Date dt = null;
String country = wdContext.currentContextElement().getCountry();
  if(country!= null){
	simpD = new SimpleDateFormat(usFormat);
	dt = simpD.parse(month+"/"+dateOfMonth+"/"+year);
    }else if(country.equalsIgnoreCase("UK")){
	simpD = new SimpleDateFormat(ukFormat);
	dt = simpD.parse(dateOfMonth+"/"+month+"/"+year);
    wdContext.currentContextElement().setTest2(new Date(dt.getTime()));
}catch(Exception ee){
manager.reportSuccess("Exception : "+ee.getMessage());

For more information go thru the link.

date format



0 View this answer in context

Helpful Answer

Not what you were looking for? View more on this topic or Ask a question