aspose file tools*
The moose likes JSF and the fly likes F:convertDateTime display Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "F:convertDateTime display " Watch "F:convertDateTime display " New topic
Author

F:convertDateTime display

Augustine Chelliah
Greenhorn

Joined: Mar 12, 2009
Posts: 28
hi,

I have a java.util.date to be displayed in the JSF page. I'm using t:outputText and f:convertDateTime to display in (MM/dd/yyyy hh:mm:ss a) format. But when the page is rendered, I'm getting the corresponding GMT time instead of the correct one.

For Eg, my date is Feb 9 2009 07:30:29 AM but i get 02/09/2009 12:30:29 PM when the page is rendered. Please help


Thanks & Regards,
Augustine
Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
To start, it returns the date/time of the server machine, not this of the client machine.
You can make use of the 'timeZone' attribute of the f:convertDateTime to control it.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15639
    
  15

One of the most irritating things about the f:converDateTime is that it doesn't attempt to use the client's locale to adjust the displayed date/time or even offer an option to do so. If you omit a timezone, GMT will be used. Not the server's time, unless you're in the GMT timezone or haven't localized the server.

My servers run a GMT hardware clock, but their OS native timezone is EST/EDT. Which is what's so frustrating, since the default convertDateTime will render times and dates in GMT even though that's not the native locale of either the clients or the servers.

The timeZone attribute will make that adjustment, but requires that the server code explicitly provide the appropriate local info, which is bad enough when the users are all in one timezone, and worse when users are scattered around the world.

I hope someday that they'll fix that.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: F:convertDateTime display
 
Similar Threads
can't run from the command line to save life
f:convertDateTime substracting a day
Problem displaying desired output
JDK malfunction
Condition check in using rendered