I have a first field on form with job beginning in date format d-m-Y (27-03-1997 for example).Second calc field is with code and can calculate a length of sevice from beginning (27-03-1997) until today.Calc field show me result in Y-m-d format(19-03-29) and work fine.Here is the code:
$start_date = '{yourtable___yourdate}'; if (!empty($start_date)) { $now_date = new DateTime(); $start_date = new DateTime($start_date); $since_start = $start_date->diff($now_date); return $since_start->format('%y-%m-%d'); } else { return "no data"; }
Now, I have another length of service (03-08-02 for example) in same form, which is done before 1997. ,and wrote in simple third field in text format(Y-m-d). I want in fourth calc field on form get the summ of those two length of service. Exactly : 24-00-01 must be result (19-03-29 + 03-08-02).One month is 30 days.Form is on Joomla 2.5 , made with form builder. Thanks for help!