I have a bit of a problem converting time between an Android phone (Nexus one) and a java server. All that I read says that they are the same, but when I convert a long stamp, I seem to lose 1 hour (for sure).
In particular, if I run the following code on an Android device, I get the following output
The code:
Calendar g = Calendar.getInstance();
g.setTimeInMillis(1340661899000L);
Log.d(TAG, g.getTime().toLocaleString());
Conclusion: June 25, 2012 18:04:59
Which I think is correct, but when I run the same code on a java server, I get the same day, but 1 hour earlier
The code:
Calendar g = Calendar.getInstance();
g.setTimeInMillis(1340661899000L);
System.out.println(g.getTime().toLocaleString());
Conclusion: 25-Jun-2012 5:04:59 PM
Does anyone know what could be causing this? And the announcement on the phone server is located in one place (not so that it matters), and the clock on both the server box and the phone correspond
source
share