PHP function of the day: date_diff()

For day 19 of 21 in the “PHP Function of the day” series, I’m going to look at date_diff().

Let’s take a look.




$difference = date_diff($shoppingDay,$payDay);


echo “<br /><br />”.$difference->format(“%R%a days”);



See the output


As you an see, this calculates the difference between two dates (something that could be pretty useful).

Leave a Reply

Your email address will not be published. Required fields are marked *