Inside this article we will see the concept to get the full day name from date in php. There are several options in php which helps to get the day name. Article contains classified information about PHP tutorial to get full day name.
If you are looking for an article which helps you to get full day name from date then you are at right place to learn in a very easy way.
Learn More –
- Encrypt Form Data in JavaScript Before Sending to Server
- Find and Count All Headings From a Web Page in PHP
- Find and Extract All Headings From a Web Page in PHP
- Find and Extract All Images From a Web Page in PHP
Let’s get started.
Example 1: Get Day Name from Date
Create a file index.php at your localhost directory.
Open index.php and write this complete code into it.
<?php $date = "2021-10-02"; $newDate = date('l', strtotime($date)); echo $newDate; // Output: Saturday
Output
Saturday
Example 2: Get Day Name from Current Date
Create a file index.php at your localhost directory.
Open index.php and write this complete code into it.
<?php $newDate = date('l'); // Current date echo $newDate; // Output: Saturday
Output
Saturday
Example 3: Get Day Name from Number
Create a file index.php at your localhost directory.
Open index.php and write this complete code into it.
<?php $numericDay = "3"; $newDate = date('l', strtotime("Sunday +{$numericDay} days")); echo $newDate; // Output: Wednesday
Output
Wednesday
We hope this article helped you to learn How To Get Full Day Name from Date in PHP Tutorial in a very detailed way.
Online Web Tutor invites you to try Skillshike! Learn CakePHP, Laravel, CodeIgniter, Node Js, MySQL, Authentication, RESTful Web Services, etc into a depth level. Master the Coding Skills to Become an Expert in PHP Web Development. So, Search your favourite course and enroll now.
If you liked this article, then please subscribe to our YouTube Channel for PHP & it’s framework, WordPress, Node Js video tutorials. You can also find us on Twitter and Facebook.