We are developing a j2me app for syncing contacts to/from a server. we are storing the update and create time (long mill sec) with each contact for conflict resolution/sync calculations.
Now as the client and server app can be in different time zones , how one can store time with time zone in a standard format (to take care diff time zones and daylight savings) for calculations at client and server side.
-
I suggest you store all times in GMT+0 and convert the time only when you display it.
-
If you use System.currentTimeMillis() you don't have to worry about time zones, because it is in universal time. From System.currentTimeMillis() Javadoc:
public static long currentTimeMillis()
[...]
Returns: the difference, measured in milliseconds, between the current time and midnight, January 1, 1970 UTC.
The time zone UTC is Coordinated Universal Time, which is mostly GMT .
starblue : Yes, time zones (including daylight savings time) are only taken into account for presenting dates to the user.
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.