Source Code:
(back to article)
<?php function get_day_name($date) { // Create a DateTime object $date_obj = new DateTime($date); // Return the day name return $date_obj->format('D'); } // Test the function echo get_day_name('2022-01-10'); // Output: Mon
Result:
Report an issue