CALCULATED FIELDS WITH DATES

drashrafsabry

Well-known member
If i have field 1 ( start Date ) and field 2 (end date), how can i make a calculated field formula to add 280 days to field 1 and the result in date format show in field 2?
 

eugenio

Administrator
Staff member
Something like this in your custom function should work (I haven't checked it):

$date = $parameters_ar['start_date_field_name'];
return date('Y-m-d', strtotime($date. ' + 280 days'));

Best,
 

eugenio

Administrator
Staff member
Hello,
yes, I forgot to mention that calculated fields are only compatble with text, textarea and select_single field types. Yes you can switch the dadabik field type to text (and keep the db field type as date) but remember that you loose some features of the date field type e.g. you won't get any check on the date validity or date syntax if the user insert manually the date.

Best,
 
Top