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

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -