Answer the question
In order to leave comments, you need to log in
How to get the second day of the month?
print_r(new DateTime('first day of -1 month'));
/*DateTime Object
(
[date] => 2018-05-01 16:35:12.011108
[timezone_type] => 3
[timezone] => Etc/GMT-3
)*/
Answer the question
In order to leave comments, you need to log in
php.net/manual/ru/datetime.add.php
<?php
$date = new DateTime('first day of -1 month');
$date->Add(new DateInterval("P5D"));
var_dump($date);
object(DateTime)#1 (3) {
["date"]=>
string(26) "2018-05-06 13:43:58.770116"
["timezone_type"]=>
int(3)
["timezone"]=>
string(3) "UTC"
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question