Here you can find the source of getDaySub(String start_time, String end_time)
public static long getDaySub(String start_time, String end_time)
//package com.java2s; //License from project: Apache License import java.text.ParseException; import java.text.SimpleDateFormat; public class Main { public static long getDaySub(String start_time, String end_time) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); long day = 0; try {/*w ww.ja v a 2s . c o m*/ long start_timeStamp = sdf.parse(start_time).getTime(); long end_timeStamp = sdf.parse(end_time).getTime(); day = (end_timeStamp - start_timeStamp) / (24 * 60 * 60 * 1000); } catch (ParseException e) { e.printStackTrace(); } return day; } }