970_90

Saturday, 25 October 2014

How to find day of week in php?

How to find day of week in php?

$timestamp = strtotime(date('2014-10-25'));
$dw = date( "w", $timestamp);// $dw will be 0 (for Sunday) through 6 (for Saturday) 
$days = array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');
echo "today is ".$days[$dw];

Output
today is Saturday


No comments:

Post a Comment