- 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
PHP - How to use $timestamp to check if today is Monday or 1st of the month?
The date function can be used to return the string formatted based on the format specified by providing the integer timestamp or the current time if no timestamp is given
The timestamp is optional and defaults to the value of time().
Example
if(date('j', $timestamp) === '1') echo "It is the first day of the month today
"; if(date('D', $timestamp) === 'Mon') echo "It is Monday today
";
Output
This will produce the following output −
It is the first day of the month today
Advertisements