Search code examples
javaandroiddatabasetimezonederby

System.currentTimeMillis exchange Java software and Android


I try to exchange informations beetween my java software and an android tool. I put System.currentTimeMillis() form my android tool to a Derby database. I'm at UTC -4.

On software:
When it's Aug 09 2016 08:32:32
long is : 1470745952393
That means Aug 09 2016 12:32:32 UTC

On Android
When shows Aug 09 2016 08:44:37 it saved 1470732277580
that means Aug 09 2016 04:44:37 for my time zone...

Does anyone have an explanation?


Solution

  • Your software locale is different from the one on your device. Check on both devices:

    java.util.TimeZone.getDefault()

    and see what it returns.