Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP strtotime returning always midnight

I'm having a weird problem. When I do strtotime it's not considering the hours part of the original date, and it's always returning midnight. I tried to research but I couldn't find anything specific.

Is there something I'm missing?

$original_date = "2015-08-07 02:00:00";
$next_date = date('Y-m-d H:i:s', strtotime("monday this Week +1 week", strtotime($original_date)));

It returns $next_date as 2015-08-14 00:00:00

like image 938
Kitara Avatar asked Aug 21 '15 04:08

Kitara


1 Answers

Try this, add time which you want to retrieve in next date,.

$original_date = "2015-08-07 02:00:00";
echo $next_date = date('Y-m-d H:i:s', strtotime("monday this Week 02:00:00 +1 week", strtotime($original_date)));
like image 149
Amit Shah Avatar answered Nov 16 '22 03:11

Amit Shah