java - Calendar getTimeInMills = July 4, 46452? -


i using calendar on samsung note. if new instance of calendar calendar.getinstance() , call gettimeinmills() without doing else 1403732346277, apparently value in far future.

i need unix style timestamp. there other preferred way this? or reason why calendar returning value (i.e. standard adjustment can make)?

unix time represents number of seconds epoch. name implies, gettimeinmillis() return number of milliseconds epoch. need divide milliseconds 1000 unix time.

long unixtime = calendar.getinstance().gettimeinmillis() / 1000; 

Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -