Here you can find the source of getCurrentTime()
public static long getCurrentTime()
//package com.java2s; //License from project: Open Source License import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static final String FMT_LONG_TIME = "yyyy-MM-dd HH:mm:ss"; public static long getCurrentTime() { try {/*from w ww .j a v a 2 s. co m*/ return new java.text.SimpleDateFormat(FMT_LONG_TIME).parse(getCurrentDate(FMT_LONG_TIME)).getTime() / 1000; } catch (Exception e) { e.printStackTrace(); } return 0L; } public static String getCurrentDate(String fmt) { DateFormat d = new SimpleDateFormat(fmt); return d.format(new Date()); } }