Consider also the second.
The -2 could be a constant defined in the browser native in charge of
the system.

-----

public final class Date_CustomFieldSerializer {
        public static void deserialize(SerializationStreamReader
streamReader, Date instance) {
                // No fields
        }

        public static Date instantiate(SerializationStreamReader
streamReader) throws SerializationException {
                Date date = new Date(streamReader.readLong());
                return fixDateServer(date, -2); // Our server is the standard 
time
of Brasilia.
        }

        public static void serialize(SerializationStreamWriter streamWriter,
Date instance) throws SerializationException {
                streamWriter.writeLong(instance.getTime());
        }

        // function to calculate local time
        // in a different city
        // given the city's UTC offset
        // 
http://www.techrepublic.com/article/convert-the-local-time-to-another-time-zone-with-this-javascript/6016329
        private static Date fixDateServer(Date d, int offset) {
                long utc = d.getTime() + (d.getTimezoneOffset() * 60000);
                d.setTime(utc + (3600000 * offset));
                return d;
        }
}

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to