Java examples for java.util:Day
day Range
//package com.java2s; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static SimpleDateFormat sdf = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss"); public static Integer dayRange(String begin, String end) { Date start = null;//from w w w. j a va2 s .c o m Date stop = null; try { start = sdf.parse(begin); stop = sdf.parse(end); } catch (ParseException e) { e.printStackTrace(); return null; } long range = (stop.getTime() - start.getTime()) / 24 / 60 / 60 / 1000; return Integer.parseInt(String.valueOf(range)); } }