By using our mini forum, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy

Q: Day of Week - PHP Classes and Objects Task

+3 votes

You are given a date in format "{day}-{month}-{year}"

Calculate and print the day of week in English.


  • Input: 18-04-2016; Output: Monday
  • Input: 27-11-1996; Output: Wednesday
asked in PHP category by user ak47seo

1 Answer

+2 votes

Here is the solution:

$input = readline();
$dayOfWeek = new DateTime($input);
echo $dayOfWeek->format("l");

Here are all the parameters of the format method of DateTime Class:

answered by user andrew