cancel
Showing results for 
Search instead for 
Did you mean: 

WD date format & Java standard locale-based pattern

Former Member
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

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

http://www.NetWeaverTeam.com

Former Member
0 Kudos

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

Answers (0)