File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSF and the fly likes Global date format for JSF Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "Global date format for JSF" Watch "Global date format for JSF" New topic
Author

Global date format for JSF

John Burton
Greenhorn

Joined: Mar 26, 2012
Posts: 5
We have dates all over the site that need to be formatted. Instead of going to each date and formatting it with the convertDateTime tag, is there a way I can just globally change the format of how it displays dates? If they change their mind on formatting and I would be stuck going through the entire site changing every one of them.

There seems like an easier way.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15950
    
  19

"Jonny Bingo"

I can give you a detailed answer, although I doubt it will make you happy.

First, however, you need to change your display name to conform to our Naming Requirements (http://www.javaranch.com/name.jsp).

We don't have a lot of rules here at the JavaRanch, but that's one of the few we insist on.


Customer surveys are for companies who didn't pay proper attention to begin with.
John Burton
Greenhorn

Joined: Mar 26, 2012
Posts: 5
What I did do that worked is create a variable in a application scoped bean that just holds some global variables. It contains the date format and I call it from the formatDateTime tag like



I am curious as to what your answer was. A better solution?

Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15950
    
  19

That's about as good as it gets. You can keep the conversion pattern in a session bean if you want to be able to customize it on a per-person basis, but the same tactic applies.

The timezone for JSF conversion unless overridden is GMT and cannot be overriden globally. The formatting pattern employed is the default locale pattern for the JVM that runs the webapp (I think). So the only way to achieve specific zones and formats is on a per-use basis.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Global date format for JSF
 
Similar Threads
Help with MS Access & Date
Need help with a query thats driving me insane
UTC formatting
Get the Difference between 2 dates
format date