• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Precision error in converter property of <h:outputText> tag?

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi.

I have a date object that I am trying to render using the <h:outputText> tag. Since the object contains the full date/time string, I am formatting using the converter property(converter="javax.faces.DateTime").

But the resulting date is a day before the actual date! Tracing this I have found that the converter property calculates the day as starting from 00:00:01 and not 00:00:00 as is standard in Java.

I am curious to find out if this is an error or intentional behaviour?
 
Saloon Keeper
Posts: 28319
210
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As far as I'm aware, the dateTime converter is employing only the standard conversion methods of the java.util.Date and Calendar classes.

One thing that bites a lot of people regarding the day, however, is that the internal date object itself is usually based on the GMT timezone (UTC). Which means that you'll usually have to localize it. This is extra fun in webapps, since the server could be on Beruit time (usually with a UTC system clock), one user could be in New York, and another could be in Shanghai. JSF doesn't attempt to deduce the client's timezone, so you have to provide it in the converter definition.
 
Live ordinary life in an extraordinary way. Details embedded in this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic