java - Determine datetime pattern based on locale -


i have following jsf code display date using pattern.

<f:convertdatetime pattern="e, d mmm, yyyy" timezone="#{localebean.timezone}" />

i pass pattern via localebean also. there way determine specific pattern based on locale?

thanks

public localebean() {   this.defaulttimezone = timezone.getdefault();   this.strlocale = locale.getdefault().tostring();   this.timezone = defaulttimezone.getdisplayname(); } 

you can try dateformat.getdateinstance. example:

   simpledateformat f = (simpledateformat)dateformat.getdateinstance(dateformat.short, locale.uk);    system.out.println(f.topattern());     f = (simpledateformat)dateformat.getdateinstance(dateformat.short, locale.us);    system.out.println(f.topattern()); 

prints:

dd/mm/yy m/d/yy 

Comments

Popular posts from this blog

java - SNMP4J General Variable Binding Error -

windows - Python Service Installation - "Could not find PythonClass entry" -

Determine if a XmlNode is empty or null in C#? -