Use this code
echo $day_of_week = date('N', strtotime('15-06-2013'));
Output
6
Question
I have a variable $date='15-06-2013'
. Now, how do I get the number of the day in the week? 15-06-2013 is a Saturday
and hence my function should return 6
as the number if I were to use N
format character
Solution
OTHER TIPS
Alternatively, using the DateTime class:-
echo (new \DateTime('15-06-2013'))->format('N');
Output:-
6