Date Difference

  • November 2019
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Date Difference as PDF for free.

More details

  • Words: 117
  • Pages: 1
public long differencedate(object sdate ,object edate) throws exception{ java.util.date date1 = null; java.util.date date2 = null; if(sdate == null){ throw new exception("start date should not be null"); } if(edate == null){ throw new exception("end date should not be null"); } if((sdate instanceof java.util.date) || (sdate instanceof java.sql.date)){ date1 = (java.util.date)sdate; } else{ throw new exception("end date should be util date or sql date"); } if((edate instanceof java.sql.date) || (edate instanceof java.util.date)){ date2 = (java.util.date)edate; } else{ throw new exception("end date should be util date or sql date"); } long diff=date1.gettime()-date2.gettime(); long days=(diff / (1000 * 60 * 60 * 24)); if(days < 0){ throw new exception("start date should be greater than end date"); } return days; }

Related Documents

Date Difference
November 2019 20
Difference
April 2020 24
Date
June 2020 29
Date
June 2020 33
: : Date :
May 2020 48