Reputation: 117
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.
Upvotes: 7
Views: 12810
Reputation: 223023
Dividing by 1000 is enough to get a Unix timestamp. You don't need any numbers of days or anything like that.
Upvotes: 8