Java TimeUnit Usage getMinutesBetweenDates(Date begin_date, Date end_date)

Here you can find the source of getMinutesBetweenDates(Date begin_date, Date end_date)

Description

Calculates duration between two Date objects.

License

Apache License

Parameter

Parameter Description
begin_date a parameter
end_date a parameter

Return

duration between two Date objects in minute

Declaration

public static int getMinutesBetweenDates(Date begin_date, Date end_date) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.util.Date;

import java.util.concurrent.TimeUnit;

public class Main {
    /**/*from   w  w  w .j a  v  a  2  s . c  om*/
     * Calculates duration between two <code>Date</code> objects.
     *
     * @param begin_date
     * @param end_date
     * @return duration between two <code>Date</code> objects in minute
     */
    public static int getMinutesBetweenDates(Date begin_date, Date end_date) {
        return (int) TimeUnit.MILLISECONDS.toMinutes(end_date.getTime() - begin_date.getTime());
    }
}

Related

  1. getInStringSeconds(String pollInterval)
  2. getLastSlotDate(final int occurrences, final int periodicity, final long firstSlotDate, final int firstSlotDay, final String selectedDays)
  3. getLongFromQueue(BlockingQueue queue)
  4. getMailServerProps(String toAddress, int smtpPort, int imapPort)
  5. getMinutes(final long milliseconds)
  6. getMinutesBetweenDates(Date firstDate, Date secondDate)
  7. getNormalizedIntervalStartTimestamp(long intervalLengthMillis, long currentTimestamp)
  8. getNowInSeconds()
  9. getOceanTime(final Date date)