Java Day Count GetDays(String strStartDate, String strEndDate)

Here you can find the source of GetDays(String strStartDate, String strEndDate)

Description

Get Days

License

Open Source License

Declaration

public static long GetDays(String strStartDate, String strEndDate)
        throws Exception 

Method Source Code

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

import java.text.DateFormat;
import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {

    public static long GetDays(String strStartDate, String strEndDate)
            throws Exception {
        DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
        Date d1 = df.parse(strStartDate);
        Date d2 = df.parse(strEndDate);
        long diff = d2.getTime() - d1.getTime();
        return diff / (1000 * 60 * 60 * 24);

    }// w ww  .j a  va 2  s.  c  o m
}

Related

  1. getDayCount(String from, String to)
  2. getDayCount(String from, String to)
  3. getDayCount(String yyyy_mm_dd_1, String yyyy_mm_dd_2)
  4. getDaysBetween(Calendar d1, Calendar d2)
  5. getDaysBetween(Map params)
  6. getDaysBetweenTwoDays(String dateFrom, String dateEnd)
  7. getDaySub(String beginDate, String endDate)