Java Minute Calculate diffOfMinutes(String begin, String end)

Here you can find the source of diffOfMinutes(String begin, String end)

Description

diff Of Minutes

License

Open Source License

Declaration

public static long diffOfMinutes(String begin, String end) throws Exception 

Method Source Code


//package com.java2s;
import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {
    public static long diffOfMinutes(String begin, String end) throws Exception {
        SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

        Date beginDate = formatter.parse(begin);
        Date endDate = formatter.parse(end);

        return (endDate.getTime() - beginDate.getTime()) / (60 * 1000);
    }/*w ww  .  j  av  a 2 s.c  o  m*/
}

Related

  1. addOrRemoveMinutes(String set, int minutesBeforeSunset)
  2. compareDateEndWithMinute(Date d1, Date d2)
  3. countTimeAfter(String date, int minute)
  4. formatDateMinutes(Date myDate, String pattern)
  5. getAlarmMinutes(String dtStart, String dtAlarm, Logger logger)
  6. getCurrCustomMinuteDate(String formatStr, int changeMinute)
  7. getForwardTimeByMinute(int minute, String format)