> > I am working on an application deployed in an ASP model using rmi with
> > a swing client. I have been running into some problems with dates
[quoted text clipped - 9 lines]
> converting to and from some human-readable string format, then you
> need to be careful.
I am serializing a java.util.Date.
Karl Uppiano - 26 Apr 2007 06:29 GMT
>> > I am working on an application deployed in an ASP model using rmi with
>> > a swing client. I have been running into some problems with dates
[quoted text clipped - 11 lines]
>
> I am serializing a java.util.Date.
You should not do that. java.util.Date is initialized with the local time
zone. Send the UTC time in milliseconds as a long instead. Use that to
reconstitute a new date at the other end. The timezone conversion will be
done automatically for you, including daylight saving time, leap years, etc.
kevin cline - 27 Apr 2007 04:18 GMT
> >> > I am working on an application deployed in an ASP model using rmi with
> >> > a swing client. I have been running into some problems with dates
[quoted text clipped - 16 lines]
> reconstitute a new date at the other end. The timezone conversion will be
> done automatically for you, including daylight saving time, leap years, etc.
A java.util.Date does not contain timezone information. The local
timezone is used only when constructing a date via deprecated
methods.
kevin cline - 27 Apr 2007 04:24 GMT
> > > I am working on an application deployed in an ASP model using rmi with
> > > a swing client. I have been running into some problems with dates
[quoted text clipped - 3 lines]
> > > hours or lose 3 hours depending on the direction of the
> > > translation.
...
> I am serializing a java.util.Date.
How do you know it is "translating itself?" When you convert a Date
to a string without explicitly specifying a timezone, the Date is
converted to a local time in the default timezone. So if you set a
Data to 9:00PM April 26th in US Eastern time, and then print the same
date on a system in US Pacific time, it will be displayed as 6:00 PM
April 26th. But they are the same time, and if you print the timezone
information, you will see that one is
GMT-05:00 and the other is GMT-08:00.