Dates and times

Parse textual datetime description into a Unix timestamp

strtotime(string $dateTimeString, ?int $baseTimestamp = null): int|false

Sort multi-dimensional array by value of a DateTime element

$mydates = [
    ['datetime' => new \DateTime('2000-01-03')],
    ['datetime' => new \DateTime('2000-01-01 12:15')],
    ['datetime' => new \DateTime('2000-01-01 12:15:30')]
];
        
usort($mydates, function ($a, $b) {
    return $a['datetime'] < $b['datetime'];
});

print_r($mydates);

Array
(
    [0] => Array
        (
            [datetime] => DateTime Object
                (
                    [date] => 2000-01-03 00:00:00.000000
                    [timezone_type] => 3
                    [timezone] => UTC
                )

        )

    [1] => Array
        (
            [datetime] => DateTime Object
                (
                    [date] => 2000-01-01 12:15:30.000000
                    [timezone_type] => 3
                    [timezone] => UTC
                )

        )

    [2] => Array
        (
            [datetime] => DateTime Object
                (
                    [date] => 2000-01-01 12:15:00.000000
                    [timezone_type] => 3
                    [timezone] => UTC
                )

        )
)