$tmp['y'] = ($PDF->PageHeight*70.5)/100;
$tmp['x'] = ($PDF->PageWidth*49.5)/100;
$PDF->ShowTextAt($tmp['x'], $tmp['y'], date('m/d/Y'));
如何將7天添加到當前日期代碼?將+ 7天添加到當前日期?
$tmp['y'] = ($PDF->PageHeight*70.5)/100;
$tmp['x'] = ($PDF->PageWidth*49.5)/100;
$PDF->ShowTextAt($tmp['x'], $tmp['y'], date('m/d/Y'));
如何將7天添加到當前日期代碼?將+ 7天添加到當前日期?
如何使用DateTime
<?php
$date = new DateTime('2000-01-01');
$date->add(new DateInterval('P7D'));
echo $date->format('Y-m-d') . "\n";
?>
strtotime
就是我想要的使用。
echo date('m/d/Y', strtotime('+7 day'));
簡單的例子:
$dt = new DateTime('+7 days');
echo $dt->format('Y-m-d');