Here you can find the source of getNextDay(String nowdate, String delay)
public static String getNextDay(String nowdate, String delay)
//package com.java2s; //License from project: Apache License import java.text.ParsePosition; import java.text.SimpleDateFormat; import java.util.*; public class Main { public static String getNextDay(String nowdate, String delay) { try {/*w w w .j av a 2 s . com*/ SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); String mdate = ""; Date d = strToDate(nowdate); long myTime = (d.getTime() / 1000) + Integer.parseInt(delay) * 24 * 60 * 60; d.setTime(myTime * 1000); mdate = format.format(d); return mdate; } catch (Exception e) { return ""; } } public static String getNextDay(Date nowdate, String delay, String pattern) { try { SimpleDateFormat format = new SimpleDateFormat(pattern); String mdate = ""; long myTime = (nowdate.getTime() / 1000) + Integer.parseInt(delay) * 24 * 60 * 60; nowdate.setTime(myTime * 1000); mdate = format.format(nowdate); return mdate; } catch (Exception e) { return ""; } } public static Date strToDate(String strDate) { SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); ParsePosition pos = new ParsePosition(0); Date strtodate = formatter.parse(strDate, pos); return strtodate; } public static String getTime() { Date currentTime = new Date(); SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); String dateString = formatter.format(currentTime); String min; min = dateString.substring(14, 16); return min; } }