How to get a day of the week from date in php?
This is a short guide on how to get the day of the week from a given date string in PHP.
1. Code:
<?php
function getDayOfTheWeek($date){
return date('w',strtotime($date));
}
$date1 = "24-06-2022 2:3:33";
echo(getDayOfTheWeek($date1));
?>
2. Example:
Input:
"24-06-2022 00:00:00"
Output:
5