如何在php symfony2 doctrine2中的DateTime字段中添加年份
我把这个作为有效期如何在php symfony2 doctrine2中的DateTime字段中添加年份,php,symfony,doctrine-orm,Php,Symfony,Doctrine Orm,我把这个作为有效期 $expireydate=new DateTime() 但这就把有效期推到了今天。我如何在这段时间内增加5年 或 如何输入构造函数。cuurent在我的构造函数中使用它$expireydate=new DateTime()我可以执行类似于$expireydate=新日期时间(+5年)的操作吗 $expiryDate->modify('+5 year'); $expiryDate = new DateTime('+5 year');
$expireydate=new DateTime()代码>
但这就把有效期推到了今天。我如何在这段时间内增加5年
或
如何输入构造函数。cuurent在我的构造函数中使用它$expireydate=new DateTime()代码>我可以执行类似于$expireydate=新日期时间(+5年)的操作吗代码>
$expiryDate->modify('+5 year');
$expiryDate = new DateTime('+5 year');