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

java - How to print docx and pdf? -

qml - Is it possible to implement SystemTrayIcon functionality in Qt Quick application -

c# - How to use process.StartInfo.Arguments in command prompt? -