java - Compute the unix timestamp for the previous midnight -
how can you, in java, compute unix timestamp truncated midnight?
php examples show making strings , parsing them back. there has cleaner way in java that, surely?
unix timestamp starts midnight utc can following
calendar c = calendar.getinstance(timezone.gettimezone("gmt")); c.set(calendar.hour_of_day, 0); c.set(calendar.minute, 0); c.set(calendar.second, 0); c.set(calendar.millisecond, 0); long unixtimestamp = c.gettimeinmillis() / 1000;
Comments
Post a Comment