Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Get days, hours and minutes that have passed from a given date
// get interval
// format of $datetime is "Y-m-d H:i:s"
$interval = (new \DateTime("now"))->diff(new \DateTime($datetime));
// get specific times
list($days, $hours, $minutes) = explode(" ", $interval->format("%d %h %i"));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment