cancel
Showing results for 
Search instead for 
Did you mean: 

Date Fomat

0 Kudos

Hi everybody!

I want to setup the date format like the settings of the local machine. Unfotunately the format of the Simple Type element which is taken over from an existing Model element is different.

Think I can set the Fomat by the IWDResourceHandler interface but how can I get the format of the locale machine?

Bye Markus

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Markus,

which local machine do you mean? As long as your Web Dynpro application will run in a single server, there might be something like a local machine (and Detlev's suggestion will work, sorry Detlev, old buddy). But if there is a cluster of servers where each single server instance might have it's own date format, the result will depend on which one you are currently "talking with".

What kind of model is the simple type from?

Best regards

Stefan

detlev_beutner
Active Contributor
0 Kudos

Hi Stefan,

> if there is a cluster of servers where each single

> server instance might have it's own date format,

Huaaaa...

> the result will depend on which one you are

> currently "talking with".

"Ladiiies & Gentlemeeen,

I don't know how you arrange your cluster environment - anyhow, I would offer you a 'china east - us west - southafrica'-mixed locale-cluster for only 1 penny!"

... that's why one shouldn't take the cheapest, ye know

Best regards

Detlev

0 Kudos

Hi everybody!

I would like to use the users which is logged in to the applications date format. As we are using our application in europe and us we would like to use their special date format.

bye markus

detlev_beutner
Active Contributor
0 Kudos

Hi Markus,

from the user you can retrieve the locale (user.getLocale(), see http://media.sdn.sap.com/html/submitted_docs/60_sp2_javadocs/ume/com/sap/security/api/IUser.html#get... and then almost like before: DateFormat df = SimpleDateFormat.getDateInstance(int style, Locale aLocale) with style as you like, FULL, LONG, MEDIUM, or SHORT (see JavaDoc).

Hope it helps

Detlev

Former Member
0 Kudos

Use something like that:

final DateFormat fmt = DateFormat.getDateInstance
(
WDResourceHandler.getCurrentSessionLocale()
);

Regards,

VS

P.S. Could someone remind me how WD resolve locale? What is the sequence: browser preferences, user-specified locale, defualt server locale or something other?

Former Member
0 Kudos

Hi Valery,

if it hasn't changed in the meantime, its:

1. Locale from URL

2. (Portal) User-specified Locale for non anonymous users

3. Browser-settings Locale

4. Locale from WD Application

5. System Locale

6. JVM Locale

Regards

Stefan

Answers (1)

Answers (1)

detlev_beutner
Active Contributor
0 Kudos

Hi Markus,


DateFormat df = SimpleDateFormat.getDateInstance();

See http://java.sun.com/j2se/1.4.2/docs/api/java/text/SimpleDateFormat.html

Hope it helps

Detlev