Java Date Now getCurrentUnixTime()

Here you can find the source of getCurrentUnixTime()

Description

get Current Unix Time

License

Open Source License

Declaration

public static int getCurrentUnixTime() throws Exception 

Method Source Code

//package com.java2s;

public class Main {
    public static int getCurrentUnixTime() throws Exception {
        long epoch = new java.text.SimpleDateFormat("dd/MM/yyyy HH:mm:ss").parse("01/01/1970 00:00:00").getTime()
                / 1000;/* w  w w.  j a  va  2  s  .  c  o m*/
        return Integer.parseInt(Long.toString(System.currentTimeMillis() / 1000 - epoch));
    }
}

Related

  1. getCurrentTimeStr()
  2. getCurrentTimeStr()
  3. getCurrentTimeString(String format)
  4. getCurrentTimeString(String pattern)
  5. getCurrentToNextDaySecond()
  6. getCurrentUTCDate()
  7. getCurrentUtcDate()
  8. getCurrentUTCSeconds(Date current)
  9. getCurrentUTCString()