The methods Calendar.getTimeInMillis()
and Date.getTime()
both return milliseconds since 1.1.1970.
For current time, you can use:
long seconds = System.currentTimeMillis() / 1000l;
More Related Contents:
- Android: If statement being skipped even if condition is correct
- Given an array of integers and a target integer k. Check if the elements in the array sum to the target [closed]
- Applying MVC With JavaFx
- Trusting all certificates using HttpClient over HTTPS
- Getting the ‘external’ IP address in Java
- In Java how do you sort one list based on another?
- Quickly read the last line of a text file?
- How to use CardLayout with Netbeans GUI Builder
- How to read and understand the java stack trace? [duplicate]
- How to refer environment variable in POM.xml?
- Change ListView background – strange behaviour
- Calling static method from another java class
- Check for Active internet connection Android
- Why does main method in Java always need arguments?
- Create dynamic table to add new entry with button
- Create a string with n characters
- Multiple classes in single file
- java.lang.NoSuchFieldError: org.apache.http.message.BasicLineFormatter.INSTANCE from Mashape Unirest in Java application
- Out of memory when encoding file to base64
- How can I list the available Cipher algorithms?
- Why does integer division by zero 1/0 give error but floating point 1/0.0 returns “Inf”?
- How to use interceptor to add Headers in Retrofit 2.0?
- Stop/cancel SwingWorker thread?
- Converting a Char into Java KeyEvent KeyCode
- Android BroadcastReceiver onReceive Update TextView in MainActivity
- How to import a Java project to Eclipse?
- How to add HTML headers and footers to a page?
- ToolProvider.getSystemJavaCompiler() returns null – usable with only JRE installed?
- Force point (“.”) as decimal separator in java
- Set Chrome’s language using Selenium ChromeDriver