Here you can find the source of getStartNextDay(Date d2)
public static Date getStartNextDay(Date d2)
//package com.java2s; import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; public class Main { public static final String VN_DATE_FORMAT = "dd/MM/yyyy"; public static Date getStartNextDay(Date d2) { Date d = getNextDay(d2);//from w w w . j a v a2s . co m String dStr = dateToString(d, null); return stringToDate(dStr, null); } public static Date getNextDay(Date d2) { if (d2 == null) d2 = new Date(); Calendar c1 = Calendar.getInstance(); c1.setTimeInMillis(d2.getTime() + 24 * 60 * 60 * 1000); return c1.getTime(); } public static String dateToString(Date date, String format) { if (format == null) format = VN_DATE_FORMAT; SimpleDateFormat ts = new SimpleDateFormat(format); return ts.format(date); } public static java.util.Date stringToDate(String src, String format) { try { src = src.trim(); if (format == null) format = VN_DATE_FORMAT; SimpleDateFormat ts = new SimpleDateFormat(format); return ts.parse(src); } catch (Exception e) { return null; } } public static java.util.Date parse(String src) { try { return DateFormat.getDateInstance().parse(src); } catch (ParseException e) { return DateFormat.getInstance().getCalendar().getTime(); } } }