Java Day dayDiff(Date date1, String date2)

Here you can find the source of dayDiff(Date date1, String date2)

Description

day Diff

License

Apache License

Declaration

public static long dayDiff(Date date1, String date2) 

Method Source Code


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

import java.text.*;
import java.util.*;

public class Main {

    public static long dayDiff(Date date1, String date2) {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        long diff = 0l;
        try {//from   www. jav  a 2  s .c  o  m
            long d1 = date1.getTime();
            long d2 = sdf.parse(date2).getTime();
            diff = (Math.abs(d1 - d2) / (1000 * 60));
        } catch (ParseException e) {
            e.printStackTrace();
        }
        return diff;
    }
}

Related

  1. dateValue(Date d)
  2. day2Day(String startDate, String endDate, String format)
  3. day2ThuesDay(Date date)
  4. dayEnd(Date date)
  5. dayFillter(String text, String type)
  6. dayFillter(String text, String type)
  7. dayFilter(Date date)