Help with date calc

m6xmed5

Member
I'm trying to calculate a date for a follow up call based on customer type, having some issues with the code in the calc element. When I enable the code the list won't load.

My code is
PHP:
$followup = new DateTime('{missed_sales___date_time}');
$type = str('{missed_sales___enquiry_for}');
$val = int();
if ($type == "cv") {
    $val = 14;
} elseif ($type == "ncv") {
    $val = 2;
} else {
    $val = -1000000;
}

$followup->modify('+{$val} day');
return $followup->format('d-m-Y');

Is this the correct way to do it?

Marc
 
Last edited:
Got it, should have been
PHP:
$myDate = new DateTime('{missed_sales___date_time}');
$type = '{missed_sales___enquiry_for}';
$val = 1;
if ($type == "cv") {
    $val = 14;
} elseif ($type == "ncv") {
    $val = 2;
} else {
    $val = 1000000;
}

$myDate->modify("+{$val} days");
return $myDate->format('d-m-Y');
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top