Here you can find the source of getDayBetween(String firstDay, String secondDay)
public static long getDayBetween(String firstDay, String secondDay)
//package com.java2s; //License from project: Apache License import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static long getDayBetween(String firstDay, String secondDay) { long dayBetween = 0L; SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd"); try {/*ww w .ja v a2 s . co m*/ Date firstDate = simpleDateFormat.parse(firstDay); Date secondDate = simpleDateFormat.parse(secondDay); dayBetween = (firstDate.getTime() - secondDate.getTime()) / 0x5265c00L; } catch (ParseException e) { dayBetween = 0L; e.printStackTrace(); } return dayBetween; } }