Last active
April 30, 2018 08:56
-
-
Save ryantbrown/a200f555d819cd87884b12a1b4811bd0 to your computer and use it in GitHub Desktop.
Get days, hours and minutes that have passed from a given date
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// 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