From official manual , the date ('w')
shows the current date as
0 = Sunday
1 = Monday
.....
6 = Saturday
The problem is , without any further modification , are there any way (eg. set parameter?) to specific the Sunday as 7 instead of 0 ? thanks
The PHP date() function is used to format a date and/or a time.
just used it - date('Y-m-d H:i:s', strtotime('+1 week')); works fine in PHP 7 to give one week from now.
The date function in PHP is used to format the timestamp into a human desired format. The timestamp is the number of seconds between the current time and 1st January, 1970 00:00:00 GMT. It is also known as the UNIX timestamp. The default time zone can also be set programmatically using PHP scripts.
Try to use 'N'
format specifier for date()
function:
date('N')
Description: ISO-8601 numeric representation of the day of the week (added in PHP 5.1.0)
Example returned values: 1 (for Monday) through 7 (for Sunday)
date('N')
N - The ISO-8601 numeric representation of a day (1 for Monday, 7 for Sunday)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With