I have IssuedDate and ExpiryDate as Date fields in A0S_Quotes. They are stored in the format 2020-02-25. I’m trying to create a beforeSave logic hook that calculates the ExpiryDate as 30 days after the IssuedDate.
This is the kind of thing i want to do -
$bean->ExpiryDate = dateSub($bean->IssuedDate, '30');
function dateSub($dateStr, $days){
global $timedate;
$date = $timedate->fromUser($dateStr);
$date->add(new DateInterval('P'.$days.'D'));
return $timedate->asUser($date);
}
I have looked at that many date related posts i’m completely baffled now. I have created a workflow, which works but is extremely slow, but need to set the date within the logic hook as part of other code