Here you can find the source of getToday()
public static long getToday()
//package com.java2s; import java.text.SimpleDateFormat; import java.util.Calendar; public class Main { private final static ThreadLocal<SimpleDateFormat> dateFormater2 = new ThreadLocal<SimpleDateFormat>() { @Override/*from w ww . j av a 2 s . co m*/ protected SimpleDateFormat initialValue() { return new SimpleDateFormat("yyyy-MM-dd"); } }; public static long getToday() { Calendar cal = Calendar.getInstance(); String curDate = dateFormater2.get().format(cal.getTime()); curDate = curDate.replace("-", ""); return Long.parseLong(curDate); } }