Page 1 of 1

Get time since given date

Posted: Tue Oct 16, 2007 9:14 pm
by Clukey
I am trying to find the amount of time that has passed since a given date (retrieved from a database), but I'm quite new to PHP date functions. I found this:

Code: Select all

$dateSrc = $info['creationdate'];
$dateTime = new DateTime($dateSrc);
The date will be formatted like this: "15:30:14 Oct 16, 2007 PDT"

Where do I go from here?

Thanks.

Posted: Tue Oct 16, 2007 9:49 pm
by Clukey
I figured it out:

Code: Select all

$created = strtotime($info['creationdate']);
$now = strtotime("now");
$difference = $now-$created;
gets difference in seconds