Time Zones in Java / GWT (Client-side)
gwt, java
Solution
Your last edit makes things clearer.
Basically, you are confused, and you already get what you want.
1239867980191 milliseconds since the Epoch translates to Thursday, April 16th, 2009, at 7:46:20.191 in the GMT time zone. The very same instant translates to the same day, but 8:46:20.191 in the GMT+01 time zone. If your input string specified "7:46:20.191" and you indeed got 1239867980191 from `Date.getTime()` then congratulations, the parsing code understood your "7:46:20.191" as to be interpreted in the GMT time zone, and did it properly.
If afterwards you get "8:46:20" when printing, this is only because you use the GMT+01 time zone for displaying that instant. Note that the string contains `GMT+100` precisely to notify you that it uses that time zone for display purposes. The instant which the `Date` instance represents is nonetheless exactly the instant you wish it to contain. Remember that a `Date` instance represents an instant in time, for which no notion of time zone applies: time zones are used to convert instants into calendar elements (days, hours...) and back.
To convert a `Date` to a displayable string, use `DateTimeFormat.format(Date, TimeZone)` which lets you specify which time zone you want to use for that string.
Problem
[Client-side GWT class] I have a Date Object... ``` Date dataObject = DateTimeFormat.getFormat("yyyy-MM-dd'T'HH:mm:ss.SSS") .parse("2009-10-12T00:00:00.000); ``` This works fine. However when I do a: ``` dateObject.getTime(); ``` It returns a UNIX Time milliseconds using a GMT with daylight savings, therefore making it a UNIX Time I cannot use. I need it in UTC. How do I do this? Currently I'm parsing a date and it is giving me back: ``` 'Thu Apr 16 08:46:20 GMT+100 2009' @ '1239867980191' ``` However the date I'm passing in is 1 hour less than this time (7:46 and not 8:46!). How do I pass in the fact it's UTC? Or if it can't use UTC (which would be ridiculous), how do I use GMT without the daylight savings?