Here you can find the source of getCurrentUnixTime()
public static int getCurrentUnixTime() throws Exception
//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)); } }