When trying to compare to php timestamps I seem to be getting an off value. Not sure what I am missing.
I would like my output to end up being something like
3days 5hours 10min since x
I am trying this out with something that should only be a difference of minutes, but end up getting numbers that are very off (31 days 19 hours 11min)
$timesince = time() - $firstdate;
$dsince = date("d",$timesince);
$hsince = date("G",$timesince);
$msince = date("i",$timesince);
I’m guessing there’s a different way I need to do this?
date() accepts an absolute timestamp value, not the difference between two values. You need to parse the difference manually (divide by 3600, then by 60 etc) There are some examples in the comments here http://php.net/manual/en/function.time.php