date - How to prevent PHP DateTime modify when echo format? -
hello,
i have simple problem outputing datetime object.
<?php $today = new datetime(); echo $today->format('y-m-d'); // 2017-04-07 echo $today->modify('+1 day')->format('y-m-d'); // 2017-04-08 echo $today->format('y-m-d'); // 2017-04-08 want 2017-04-07
i don't want change object @ output. when echo $x+1, $x not changing it's value. how can work that? need technique output datatime db in cron. output many times , declaring datetime object before each output ruin code , effectivity (for example 50.000 users * 30 additional datetime object declarations.)
please help,
arthur
does ?
$start = new datetimeimmutable('2013-01-29'); $datetime = $start->modify('+1 day'); echo $datetime->format('y-m-d h:i:s');
Comments
Post a Comment