This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
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 EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "jsf page shows date one day back" Watch "jsf page shows date one day back" New topic

jsf page shows date one day back

Joby Chacko

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: 15629

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:
subject: jsf page shows date one day back
Similar Threads
example of source code for insert a date
How to check this rendered condition
Is FacesContext an object for entire aplication, or it's instantiated for each jsf page?
Can we Access FacesContext outside FacesServlet
JSF bookmark