Here you can find the source of getBeginTimeOfDay(Date date, int offset)
public static long getBeginTimeOfDay(Date date, int offset)
//package com.java2s; //License from project: Apache License import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; public class Main { private static final String DATE_FORMAT = "yyyyMMdd"; public static long getBeginTimeOfDay(Date date, int offset) { Calendar calendar = Calendar.getInstance(); calendar.setTime(date);//from w w w. ja v a2 s . co m calendar.add(Calendar.DAY_OF_YEAR, offset); date = calendar.getTime(); SimpleDateFormat dateFormat = new SimpleDateFormat(DATE_FORMAT); return Long.valueOf(dateFormat.format(date) + "0000"); } }