Here you can find the source of getNextDay(String date)
public static String getNextDay(String date)
//package com.java2s; //License from project: Open Source License import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Calendar; public class Main { public static String getNextDay(String date) { SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); try {//from w w w. ja va 2s.c o m long time = format.parse(date).getTime(); Calendar cal = Calendar.getInstance(); cal.setTimeInMillis(time); cal.set(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), cal.get(Calendar.DAY_OF_MONTH), 0, 0, 0); cal.add(Calendar.DAY_OF_MONTH, 1); return format.format(cal.getTime()); } catch (ParseException e) { e.printStackTrace(); } return null; } public static long getTime(String time) { SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); try { return format.parse("1970-01-01 " + time).getTime() - format.parse("1970-01-01 00:00:00").getTime(); } catch (ParseException e) { e.printStackTrace(); } return 0; } }