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,
Joined: Oct 08, 2006
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.
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.