Get Current Month,Year,Week,Day,Time in PHP

This program is helps to get current month,date,week,time and year. php has some Inbuilt functions and those functions are used to find year, month, date, time.

Source code :

$mon = strtotime("last monday");
$mon = date('w', $mon)==date('w') ? $mon+7*86400 : $mon;
$sun = strtotime(date("Y-m-d",$mon)." +6 days");
$week_start = date("Y-m-d",$mon);
$week_end = date("Y-m-d",$sun);

echo date('l jS \of F Y h:i:s A');
echo "Current week starts from $week_start to $week_end ";


Output :

Thursday 24th of August 2017 02:58:36 AM Current week starts from 2017-08-21 to 2017-08-27 

Output :


Comments :