on 08-31-2006 7:31 AM
Hi,
I have a requairement to implement application that utilize WebDynpro and Servlet programming in one product. Application must be fully localizable. My only problem at the moment is to make WD date input field working exactly thesame as standard Java DateFormat class (or inversely to make Java DateFormat class work in exactly the same way as WD date input field). For example:
Locale: en_GB (set in browser properties and assigned to portal user)
WD date input field: 31/08/2006
Java DateFormat class: 31/08/06
Snipped of code that produces formated Java date:
DateFormat.getDateInstance(DateFormat.SHORT, locale).format(date);
The only problem with this locale is 2-digits year field instead of 4-digits, but in other locales there might be other problems.
I would be appreciate for any help.
Kind regards,
Marcin Zduniak
Marcin,
Technically, the required format on servlet side is:
DateFormat format = new SimpleDateFormat("dd/MM/yyyy", locale);
System.out.println( format.format(new Date()) );
However, it's quite complex task to make generic mapping for every locale -- most probably you need internatioanlized property files (one per locale) with formatting strings.
Valery Silaev
EPAM Systems
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank for the reply. Unfortunately I need a generic solution.
The solution that satisfy me the most would be a documentation that describe patterns that are used by WebDynpro to format date fields according to portal user's locale. Is it available anywhere ?
Kind regards,
Marcin Zduniak / http://zduniak.com
User | Count |
---|---|
93 | |
11 | |
10 | |
9 | |
9 | |
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.