In every scenario, the date functions and calculations are more import and effective way to have it. Here I used to get the correct and notice date as an example. I'm just converting the DateTime to the temp value and stored in a variable. Then I go for the calculation the differences of the dates (i.e). The current date and notice date /* *@ TO Get the Date Difference of the Current_date and FirstNoticeDate *@ Param Current_date, FirstNoticeDate. *@ Return Due Days */ function Days_Different($current_date, $notice_date) { //To Change the Date Format to StringtoTime: $temp_current_date = strtotime($current_date); $temp_notice = strtotime($notice_date); // Calculate the Date Difference for the Days $days_difference = (($temp_current_date - $temp_notice) / (60*60*24)); return $days_difference; } Reference : http://stackoverflow.com/questions/2040560/finding-the-number-of-days-between-two-dates
Learn Code Write Code and Read Code