date converter

<h:outputText value="Start" />

<h:inputText id="startDate" value="#{form.startDate}">

<f:convertDateTime pattern="MM/dd/yyyy" />

<hx:inputHelperDatePicker />

</h:inputText>

I have this simple code, whenever I submit the form, and display the start date in action class, it is printing a day before. Like, if I set the date as 08/24/2006, I am getting 'Wed Aug 23 20:00:00 EDT 2006'

Thanks in Advance.

[476 byte] By [varmawkua] at [2007-10-3 3:30:27]
# 1

Most likely something to do with the timezone or locale not being set right (the date is parsed in one zone and printed in a different one).

You could try setting the "timeZone" attribute of your "convertDateTime" tag, and also where are you getting "'Wed Aug 23 20:00:00 EDT 2006'" from? If you are justing calling startDate.toString(), it will be using the default timezone and date format for your platform. It is usually better to use a DateFormat, and explicitly set the timezone on that also.

tony_robertsona at 2007-7-14 21:24:21 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2
Thanks tony.I got it. Its due to my local server which is in EDT timezone and so it is converting normal GMT date to EDT and so the difference of 4 hrs. all our qa, prod servers shud be having GMT timezones and it shud be working fine there.
varmawkua at 2007-7-14 21:24:21 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...