"epicwinter" <> wrote in message
news: oups.com...
> On Apr 24, 3:40 pm, kevin cline <kevin.cl...@gmail.com> wrote:
>> On Apr 23, 7:48 pm, epicwinter <epicwin...@hotmail.com> wrote:
>>
>> > 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
>> > when the client is on a different timezone than the server. If the
>> > client is on est and the server runs on pct then when the client
>> > submits a date time it translates itself and so i could either gain 3
>> > hours or lose 3 hours depending on the direction of the
>> > translation.
>>
>> What do you mean "translates itself?" How are you passing times from
>> the client to the server? If you serialize and then deserialize
>> either a Date or a Calendar you should have no problem. If you are
>> converting to and from some human-readable string format, then you
>> need to be careful.
>
> 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.
|