[android-developers] Re: [Help] How to get current UTC time?

2010-04-28 Thread String
On Apr 28, 7:31 am, Vincent Tsao caojunvinc...@gmail.com wrote:

 As you know, i can use System.currentTimeMillis() to fetch current local
 time, but how to convert local time to UTC time?

Are you sure that currentTimeMillis() gives you local time? It's
documented as the current system time in milliseconds since January
1, 1970 00:00:00 UTC. From that description, I'd expect it to return
a raw millisecond count; there's no timezone offset involved. If
anything, it's going to be UTC, but in truth, it isn't inherently in
*any* time zone.

It all depends on what you're wanting to do with the timestamp. We
probably need more information to guide you here.

String

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] Re: [Help] How to get current UTC time?

2010-04-28 Thread Vincent Tsao
On Wed, Apr 28, 2010 at 3:57 PM, String sterling.ud...@googlemail.comwrote:

 On Apr 28, 7:31 am, Vincent Tsao caojunvinc...@gmail.com wrote:

  As you know, i can use System.currentTimeMillis() to fetch current local
  time, but how to convert local time to UTC time?

 Are you sure that currentTimeMillis() gives you local time? It's
 documented as the current system time in milliseconds since January
 1, 1970 00:00:00 UTC. From that description, I'd expect it to return
 a raw millisecond count; there's no timezone offset involved. If
 anything, it's going to be UTC, but in truth, it isn't inherently in
 *any* time zone.

 It all depends on what you're wanting to do with the timestamp. We
 probably need more information to guide you here.

 String


hi String,  i have misunderstand this description return the local system
time in milliseconds in doc. and ask this stupid question, sorry for that.
thanks for your response





 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en