Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Date Problem in jsf  RSS feed

 
pownraj kasi
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,

I have a task to fetch a date field from database and display it in rich data table.the problem is date field is displayed.
but it displays a wrong date.

for ex
If the database date field is Feb 15,2011 means it displays Feb 14,2011. it shows one day before .if it is may 20 means ,jsf shows may 19th.

i don't know,where the pblm is..

please reply asap..i am stucking this with one day..

Thanks & Regards,
Pownraj
 
Tim Holloway
Bartender
Posts: 18531
61
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Unfortunately, on the JavaRanch, ASAP can mean a day or 3. The downside of free advice is that there's not a complete set of experts on duty 24x7.

But I'm here now, and the answer is:

Your date is being coverted according to the UTC timezone. If, for example, your web client was in California, that means that you'd be roughly 9 hours different, and the new day would begin while it was late afternoon.

To get around this, you have to supply the locale of the timezone you want to use in the display.

The up side of this, is that webapps can be truly world-wide, since the same clock standard is used everywhere. The down side is that outside of London and Paris, most of us are in some other time zone and so conversion is necessary.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!