Using java.util.Date this comes without surprise, because
Date itself doesn't contain any timezone-information.
> Is this still the appropriate method by which Date information should
> be saved and if I need to recompile all of the GWT classes ( I hope
> not ) which jar files am I re creating?
Saved or serialized? IMHO:
Saved: UTC-times
Serialized: W3C-formatted string representation of the date
Regards, Lothar
I think this use case is way too common for it not to be supported
natively by GWT.
It's gwt-user.jar that contains the custom field serializers. Don't
forget that if you do this, you may need to change the custom field
serializers for java.sql.Date and java.sql.Timestamp if your project can
also send those via RPC.
Paul
first of all (offtopic), try to conform to the quoting standards.
preceding '--'s are not.
leslie schrieb:
>
> --Saved or serialized? IMHO:
> --Saved: UTC-times
> --Serialized: W3C-formatted string representation of the date
>
> It looks like you are suggesting that rather than send the Date to the
> server, Dates should be converted to Strings to be serialized? For
> example, suppose I have a simple object "Person" with two attributes,
> one of which is a Date.
>
> public class Person {
> private String fullname;
> private Date birthdate;
> }
We were talking about dates where you need timezones. A birthday
is a quite bad example for that.
> How should I send the Date information as String, at what point should
> it be converted? I'd rather not change my model attributes from Date
> type to String.
Date is just an Object around a long-value representing the
milliseconds since Jan 1, 1970 00:00:00 UTC. So you can send
the UTC time to the server or you evaluate the HTTP-request-
headers of the request on the server side to find out what
timezone the browser resides in to convert it to UTC on
server-side.
Regards, Lothar
Paul