Java Calendar Different diff(Calendar value1, Calendar value2, int millisInCondition)

Here you can find the source of diff(Calendar value1, Calendar value2, int millisInCondition)

Description

diff

License

Open Source License

Declaration

public static long diff(Calendar value1, Calendar value2,
            int millisInCondition) 

Method Source Code

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

import java.util.Calendar;

public class Main {
    public static long diff(Calendar value1, Calendar value2,
            int millisInCondition) {
        long result = 0;
        long v1 = (value1.getTimeInMillis() + value1
                .get(Calendar.ZONE_OFFSET)) / millisInCondition;
        long v2 = (value2.getTimeInMillis() + value2
                .get(Calendar.ZONE_OFFSET)) / millisInCondition;
        result = v2 - v1;//from w  w  w .j av  a  2  s  .  c  om
        return result;
    }
}

Related

  1. dateDiff(int type, Calendar fromDate, Calendar toDate)
  2. dateDiff(int type, Calendar fromDate, Calendar toDate, boolean future)
  3. dateDiff(int type, Calendar fromDate, Calendar toDate, boolean future)
  4. dateDiff(long dateUtilitiesUnitField, Calendar firstDate, Calendar secondDate)
  5. dateDifferenceInMin(Calendar startDate, Calendar stopDate)
  6. diffDay(Calendar calendar, int day)
  7. diffDays(Calendar startDate, Calendar endDate)
  8. differenceInDays(Calendar date1, Calendar date2)
  9. formatTimeDiff(Calendar ref, Calendar now, boolean ignoreMS)