on 09-20-2006 11:25 AM
Hi All,
I want to have adate picker according to the language selected.
Can any one of you help me in doing this.
Regards
DK
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;
wdContext.currentContextElement().setTest2(null);
java.util.Date dt = null;
String country = wdContext.currentContextElement().getCountry();
try{
if(country!= null){
if(country.equalsIgnoreCase("USA")){
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.
Regards,
Sridhar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
What do you mean wit "the language selected"? The date picker should always come up in the session locale, if not it's a bug.
Armin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
88 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.