I want to get the actual time and add one day to it, setter below is datetime column type and it doesn't accept the date function. What should i do?
$password->setExpiretime(date("Y-m-d", time() + 86400));
I want to get the actual time and add one day to it, setter below is datetime column type and it doesn't accept the date function. What should i do?
$password->setExpiretime(date("Y-m-d", time() + 86400));
You may use format
method on an instance of DateTime
class:
$tomorrow = new DateTime('tomorrow');
$password->setExpiretime($tomorrow->format('Y-m-d'));
According to the comment submitted by the OP, if the return type should be DateTime
Object, you may just use:
$tomorrow = new DateTime('tomorrow');
$password->setExpiretime($tomorrow);