Anyone have any idea how I would go about converting a timestamp in milliseconds from 1970
(from Android's System.currentTimeMillis();
) to a UNIX timestamp? It need only be accurate to the day.
I figure I could divide by 1000
to get seconds, and then divide by 86400
(number of seconds in a day) to get the # of days. But I'm not sure where to go from there.
Many thanks.
Divide it by 1000
Dividing by 1000 is enough to get a Unix timestamp. You don't need any numbers of days or anything like that.
long unixTime = System.currentTimeMillis() / 1000L;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With