Here you can find the source of getWeeHours()
public static Date getWeeHours()
//package com.java2s; //License from project: Apache License import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; public class Main { public static final String DEFAULT_FORMAT = "yyyy-MM-dd HH:mm:ss"; public static Date getWeeHours() { Calendar calendar = Calendar.getInstance(); calendar.set(Calendar.HOUR_OF_DAY, 0); calendar.set(Calendar.MINUTE, 0); calendar.set(Calendar.SECOND, 0); return calendar.getTime(); }//from ww w. j av a2s . c om public static long getTime(String dateStr, String formate) { Date date; try { date = getDate(dateStr, formate); return date.getTime(); } catch (ParseException e) { return -1; } } public static long getTime(String dateStr) { return getTime(dateStr, DEFAULT_FORMAT); } public static String getDate(Date date, String formate) { SimpleDateFormat sf = new SimpleDateFormat(formate); return sf.format(date); } public static Date getDate(String dateStr, String formate) throws ParseException { SimpleDateFormat sf = new SimpleDateFormat(formate); return sf.parse(dateStr); } }