Here you can find the source of timestamp()
public static long timestamp()
//package com.java2s; //License from project: Open Source License public class Main { public static long timestamp(int year, int month, int dayOfMonth) { Calendar cal = Calendar.getInstance(); cal.set(year, month, dayOfMonth, 0, 0); cal.set(Calendar.SECOND, 0); return cal.getTimeInMillis(); }/*from w ww. j a v a 2 s .co m*/ public static long timestamp() { return timestampStartOfDay(System.currentTimeMillis()); } public static long timestampStartOfDay(long time) { Calendar cal = Calendar.getInstance(); cal.setTimeInMillis(time); cal.set(Calendar.HOUR_OF_DAY, 0); cal.set(Calendar.MINUTE, 0); cal.set(Calendar.SECOND, 0); return cal.getTimeInMillis(); } }