I'm trying to get the difference between two datetimes and return it as a datetime
. I've found examples using diff
but I can't seem to get it right.
$timein = date("Y-m-d H:i:s");
$timeout = date("Y-m-d 20:00:00");
$totaltime = $timein->diff($timeout);
However $totaltime
logs 0000-00-00 00:00:00
to my DB. Is this because I'm not formatting my totaltime variable?
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…