How to Get Full Day Name from Date using PHP
In this tutorial, we will learn How to Get a Full Day Name from Date using PHP. I will give you the PHP date function to get a full-day name. You learned how to get a full-day name in PHP using the date function.
Also read: How to Get Next Month Date using PHP?
I will give you an example of how to get day name from date using PHP. so don’t waste time to see the below example:
Consent
- Get Day Name from Date
- Get Day Name from Current Date
- Get Day Name from Number
Also read: How to Get Tomorrow Date using PHP?
Get Day Name from Date
<?php
#index.php
$date = "2021-11-20";
$new_date = date('l', strtotime($date));
echo $new_date;
?>
Output: Saturday
Get Day Name from Current Date
<?php
#index.php
$new_date = date('l');
echo $new_date;
?>
Output: Saturday
Get Day Name from Number
Also read: How to Get Yesterday Date using PHP?
<?php
#index.php
$day = "3";
$new_date = date('l', strtotime("Tuesday +{$day} days"));
echo $new_date;
?>
Output: Friday