Home > Article > Backend Development > PHP returns the day of the week based on timestamp_PHP Tutorial
02 /**
03 * Return the day of the week based on the timestamp
04 * @param string $time timestamp
05 * @return day of the week
06*/
07 function weekday($time)
08 {
09 if(is_numeric($time))
10 {
11 $weekday = array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');
12 return $weekday[date('w', $time)];
13 }
14 return false;
15 }
16 var_dump(weekday($_SERVER['REQUEST_TIME']));
17 ?>
Excerpted from: Ji Jie’s blog