I’m using System.currentTimeMillis(); to get the current time for my ‘modified’ db field. I’m converting it to unix epoch by dividing it by 1000.
However, even when the phone’s / emulator’s date and time are set to true time, the value stored in the db is 2 hours earlier than true time.
I’m in GMT+2, but I can’t find how this is affecting.
Doesn’t System.currentTimeMillis(); get the current time for the current time settings ?
use Calendar.getInstance() instead, as this:
This
curTimeobject will be locale-specific.From the API, in regards to currentTimeMillis()