Page 1 of 1

How much time left and how much time past between times

Posted: Wed Mar 07, 2012 6:13 am
by lovelf

Code: Select all

<?php
$date = new DateTime();
$date=$date->format('Y-m-d H:i:s');
echo $date;
outputs: 2012-03-07 13:05:11
?>
I would like to check against a same format of date for time left between one date an another and time past between one date an another, a simple function that returns the time left between a data and another and that returns the time past between one date an another, it can be in hours, days, or minutes. For example: two days past or two days left, or two hours past or two hours left, or 10 minutes past or 10 minutes left.

Re: How much time left and how much time past between times

Posted: Wed Mar 07, 2012 6:17 am
by Celauran