
- PHP 7 Tutorial
- PHP 7 - Home
- PHP 7 - Introduction
- PHP 7 - Performance
- PHP 7 - Environment Setup
- PHP 7 - Scalar Type Declarations
- PHP 7 - Return Type Declarations
- PHP 7 - Null Coalescing Operator
- PHP 7 - Spaceship Operator
- PHP 7 - Constant Arrays
- PHP 7 - Anonymous Classes
- PHP 7 - Closure::call()
- PHP 7 - Filtered unserialize()
- PHP 7 - IntlChar
- PHP 7 - CSPRNG
- PHP 7 - Expectations
- PHP 7 - use Statement
- PHP 7 - Error Handling
- PHP 7 - Integer Division
- PHP 7 - Session Options
- PHP 7 - Deprecated Features
- PHP 7 - Removed Extensions & SAPIs
- PHP 7 Useful Resources
- PHP 7 - Quick Guide
- PHP 7 - Useful Resources
- PHP 7 - Discussion
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
- Related Articles
- PHP 8 – How to use ValueError to check if the value encountered is of correct type?
- How to check if a timestamp is set in MySQL?
- PHP program to check if a number is prime or not
- Python Pandas CustomBusinessHour - Check if the given timestamp is on offset or not
- MySQL query to convert timestamp to month?
- Extract the Day / Month / Year from a Timestamp in PHP MySQL?
- Convert DATE timestamp to return the month number
- PHP program to check if a year is leap year or not
- PHP program to check if the total number of divisors of a number is even or odd
- How to check a file is video type or not in php?
- How to check if a field in MongoDB is [] or {}?
- How to check if the value is primitive or not in JavaScript?
- How to Check if PHP session has already started?
- Convert DATE timestamp to return only the month name in MySQL
- How to convert number to month name in PHP?

Advertisements