android - System.currentTimeMillis() returns wrong date -


i trying save current time shared preferences reason current time of ridiculous amount, in far future year of 47486.

i have checked date settings on device , date there correct , cannot find problem anywhere. hoping here may able me.

here problem is:

public static void setlastsyncsucceeded(final context context) {      sharedpreferences sp = preferencemanager.getdefaultsharedpreferences(context);      long currenttime = system.currenttimemillis();      sp.edit().putlong(pref_last_sync_succeeded, currenttime).commit(); } 

so while debugging noticed currenttime 1436374427923 tue, 23 nov 47486 00:38:43 gmt...

the value have there milliseconds (as in currenttimemillis) , you're treating if seconds.

divide thousand (i.e., turn seconds) , more sensible value of wed, 08 jul 2015 16:53:47 gmt.


Comments

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

php - Best Light server (Linux + Web server + Database) for Raspberry Pi -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -