Created
February 2, 2015 20:03
-
-
Save jjmartucci/0b9bd6872259440fc129 to your computer and use it in GitHub Desktop.
Sort by DateTime
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
$arr = array(...); | |
usort($arr, function($a, $b) { | |
$ad = new DateTime($a['dateTime']); | |
$bd = new DateTime($b['dateTime']); | |
if ($ad == $bd) { | |
return 0; | |
} | |
return $ad < $bd ? 1 : -1; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment