Precision error in converter property of <h:outputText> tag?
Joined: Aug 03, 2011
I have a date object that I am trying to render using the <hutputText> 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?
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.
Customer surveys are for companies who didn't pay proper attention to begin with.