Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

jsf page shows date one day back

 
Joby Chacko
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 18163
53
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic