Hi Ryan,
this should be a timezone issue. The date is timezone sensitive, so take
a look at java.util.TimeZone and especially at what timezone your
datepicker / datefield is set to use. You might have to override that.
Have a look to the Timezone of the Date object in your debugger before
persisting to DB, and afterwards.
I bet there's a TZ conversion happening somwhere that subtracts that one
hour you are missing. Also check for Daylight Savings time, that might
explain why it only happens with certain dates.
BR,
Stephan
Ryan LaHue wrote:
> I have a DateTextField to which I am adding a DatePicker. The Display works
> fine: if I select 4/1/2009 using the DatePicker and I save the form data to
> my database, then populate the form again from values in the database, I am
> seeing 4/1/2009.
>
> But when I look at my database I see that the stored date is actually
> 3/31/2009 23:00:00, which is 1 hour before 4/1/2009.
>
> This does not seem to be a Locale issue (that I can tell), as I am running
> everything on my local machine. Also, the odd thing is that when I select
> 4/1/2009 through 4/5/2009 I get a date stored in my database which is 1 hour
> before the selected date. But when I select anything from 4/6/2009 through
> 4/30/2009 the date is stored correctly.
>
> I added log statements when the info is loaded from the database and before
> it is persisted, and the issue is within the web application. When I print
> the dates before persisting them to the database they are wrong by 1 hour,
> for 4/1/2009 through 4/5/2009.
>
> I had the same issue with yui.DateField, but I'm not sure if this is a YUI
> DatePicker issue or something else I am not considering or doing correctly.
>
> Here's a snippet of my code:
>
> DateTextField appointmentPickerTextField = new
> DateTextField("dayOfYear", new PropertyModel(appointment, "dayOfYear"), new
> StyleDateConverter(false)) {
> @Override
> public boolean isVisible() {
> return appointment.getScheduledDate() != null;
> }
> };
> appointmentPickerTextField .setRequired(true);
> appointmentPickerTextField .add(new DatePicker());
>
> Any thoughts?
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]