- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to get first day of week in PHP?
To get the first day of the week in PHP, the code is as follows −
Example
<?php $res = date('l - d/m/Y', strtotime("this week")); echo "First day = ", $res; ?>
Output
This will produce the following output −
First day = Monday - 09/12/2019
Example
Let us now see another example −
<?php echo "Displaying Sunday as first day of a week...
"; $res = date('l - d/m/Y', strtotime("sunday 0 week")); echo "First day (next week) = ", $res; ?>
Output
This will produce the following output −
Displaying Sunday as first day of a week... First day (next week) = Sunday - 15/12/2019
Advertisements
To Continue Learning Please Login
Login with Google