jeudi 21 novembre 2019

If a Date exist return a calculated date

I have the code below to add days to a date.

$date = '[[lbc_dates_lbc_date]]';
$date = date('d F y', strtotime('+28 days', strtotime($date)));
echo $date;

This works perfectly for cases where a date entry actually exists, however, it's displaying an odd date for cases where date entry doesn't exist yet (blank).

Can you amend the code to say if a date exists add days, otherwise leave blank?

Please see image attached (errors in red, correct view in green)

enter image description here

Thanks

Aucun commentaire:

Enregistrer un commentaire