php - Finding the number of days between two dates which is stored in m/d/Y format -


this question has answer here:

i want calculate expiry date percentage.but starting date , expirydate in m/d/y format.how find number of days between starting date , ending date???this code...

 foreach ($result['query'] $row) {             $validitystart = $row->validitystart;             $expirydate = $row->expirydate;             $today = date('m/d/y');             $maxdiff = date_diff($expirydate, $validitystart);             $diff = date_diff($expirydate, $today);             $percentage = ($diff * 100) / $maxdiff;         } 

among hundreds of duplicates here on stackoverflow, might have found bit of searching

$date1 = datetime::createfromformat('m/d/y', $date1); $date2 = datetime::createfromformat('m/d/y', $date2);  $diffdays = $date2->diff($date1)->format("%a"); 

Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -