Sometimes we need to show the day of week for a given date. At some places, we want to show the day of the week and we are having the date. I am explaining the process to get the week day name using only one line of code.

We can do this by the use of php date() function by modifying it as per our needs. By this we can easily get the name of week for any date whether it is past, present or future. So to find this just use the below mentioned code :

<?php

$sunil_date = 17;   //date of required date
$sunil_month = 07;  //month of required date
$sunil_year = 2015; // year of required date
$required_day = date("l", mktime(0, 0, 0, $sunil_month, $sunil_date, $sunil_year));
echo $required_day; //here it will give friday

?>

Just modify the date for which you want to get the day of week, it will provide you the desired result.