aspose file tools*
The moose likes JSF and the fly likes jsf page shows date one day back Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "jsf page shows date one day back" Watch "jsf page shows date one day back" New topic
Author

jsf page shows date one day back

Joby Chacko
Greenhorn

Joined: Feb 22, 2012
Posts: 2
When i show the date in jsf page that is fetched from sql table, i get date which is one date back.
Please reply
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16305
    
  21

Welcome to the JavaRanch, Joby!

We always try to reply, although it can take a day or 2 sometimes, since we're volunteers, not people paid to be standing by 24x7.

This is probably a timezone issue. There are 2 different places where time zones can be wrong. One is in the database. Some databases will convert dates that are stored into a preferred timezone which is usually either the local timezone or Universal Time (UTC). The other place where timezones can go wrong is in the datetime converter in JSF. Unless you explicitly say otherwise, the default timezone for a date in JSF will always be UTC.

So, in short, it's likely you're not literally off by a day, just a fraction of a day. When it's 22:50 my local time (EST), it's already 03:50 UTC the next day. Give or take an hour. I never can get it right on the first try.


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: jsf page shows date one day back