Java Day Count getDayCount(String yyyy_mm_dd_1, String yyyy_mm_dd_2)

Here you can find the source of getDayCount(String yyyy_mm_dd_1, String yyyy_mm_dd_2)

Description

get Day Count

License

Apache License

Declaration

public static int getDayCount(String yyyy_mm_dd_1, String yyyy_mm_dd_2) throws ParseException 

Method Source Code

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

import java.text.ParseException;
import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {

    public static int getDayCount(String yyyy_mm_dd_1, String yyyy_mm_dd_2) throws ParseException {
        SimpleDateFormat myFormatter = new SimpleDateFormat("yyyy-MM-dd");
        Date date = myFormatter.parse(yyyy_mm_dd_1);
        Date mydate = myFormatter.parse(yyyy_mm_dd_2);
        return (int) ((date.getTime() - mydate.getTime()) / (24 * 60 * 60 * 1000));
    }//from   ww  w.  ja  v a2  s  . c o m
}

Related

  1. getDayCount(String from, String to)
  2. getDayCount(String from, String to)
  3. GetDays(String strStartDate, String strEndDate)
  4. getDaysBetween(Calendar d1, Calendar d2)
  5. getDaysBetween(Map params)
  6. getDaysBetweenTwoDays(String dateFrom, String dateEnd)