Java examples for java.util:Minute
get Minute Difference Between Time
//package com.java2s; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Locale; public class Main { private static SimpleDateFormat sdf_YYMMDD_HHMMSS = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss", Locale.CHINA); public static int getMinuteDifferenceBetweenTime(String start, String end) {/*from ww w .j a va 2 s. co m*/ Calendar c1 = Calendar.getInstance(); Calendar c2 = Calendar.getInstance(); try { c1.setTime(sdf_YYMMDD_HHMMSS.parse(start)); c2.setTime(sdf_YYMMDD_HHMMSS.parse(end)); return (int) Math.abs(c1.getTimeInMillis() - c2.getTimeInMillis()) / 60000; } catch (ParseException pe) { return 0; } } }