Hi! Could we please enable some services and cookies to improve your experience and our website?
Online Sandbox for SQL and PHP: Write, Run, Test, and Share SQL Queries and PHP Code
<?php
$timestamps = array();
for ($i = 0; $i < 5000; $i++) {
$timestamps[] = mt_rand(strtotime('1900-01-01 00:00:00 am'), strtotime('2100-12-31 11:59:59 pm'));
}
$mapped = array_map(
function($t) {
return [strtotime(date('H:i:s', $t)), strtotime(date('Y-m-d h:i:s a', $t))];
},
$timestamps
);
$res = array_column($mapped, 1, 0);
echo date('Y-m-d h:i:s a', $res[max(array_keys($res))]);