Java Calendar Hour elapsedHours(Calendar aFirstDate, Calendar aSecondDate)

Here you can find the source of elapsedHours(Calendar aFirstDate, Calendar aSecondDate)

Description

elapsed Hours

License

Open Source License

Declaration

public static long elapsedHours(Calendar aFirstDate, Calendar aSecondDate) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.util.Calendar;

public class Main {
    public static long elapsedHours(Calendar aFirstDate, Calendar aSecondDate) {
        return Math.abs(millisToHours(aSecondDate.getTimeInMillis() - aFirstDate.getTimeInMillis()));
    }//from ww w  .  java  2  s .c o m

    private static long millisToHours(long millis) {
        return millis / 1000 / 60 / 60;
    }
}

Related

  1. get24Hour(Calendar calendar)
  2. getHour(boolean twentyFour, Calendar calendar)
  3. getHour(Calendar cal)
  4. getHour(Calendar cal)