I have an array such as:
Array ( [0] => Array ( [id] => 2 [type] => comment [text] => hey [datetime] => 20
From php7 you can use the Spaceship operator:
usort($array, function($a, $b) { return new DateTime($a['datetime']) <=> new DateTime($b['datetime']); });