A
|
admin author 10/5/2017 |
Thanks But I am not able to figure out as I tried following but its not working |
![]() |
HJB 10/5/2017 |
DATEDIFF(due_date,date_given) |
A
|
Andrew S 10/5/2017 |
I use the following in one of my projects and it works. May not be the most efficient! This code is in bookings events before record added. |
A
|
admin author 10/17/2017 |
I use the following in one of my projects and it works. May not be the most efficient! This code is in bookings events before record added. Customer enters Start Date (BookingsStartDate) and End Date (BookingEndDate) once calculation done, the days are stored in BookingNights The following $diff = abs(strtotime($values["BookingStartDate"]) - strtotime($values["BookingEndDate"])); $years = floor($diff / (365606024)); $months = floor(($diff - $years 365606024) / (30606024)); $values["BookingNights"] = floor(($diff - $years 365606024 - $months30606024)/ (606024)); Hope that helps
|
A
|
Andrew S 10/18/2017 |
You need to make sure you change the field names to whatever your field names (those in bold below) and the code is added via Events -> Before record added |
A
|
admin author 10/18/2017 |
You need to make sure you change the field names to whatever your field names (those in bold below) and the code is added via Events -> Before record added $diff = abs(strtotime($values["BookingStartDate"]) - strtotime($values["BookingEndDate"])); $years = floor($diff / (365606024)); $months = floor(($diff - $years 365606024) / (30606024)); $values["BookingNights"] = floor(($diff - $years 365606024 - $months30606024)/ (606024)); Andrew
|
A
|
Andrew S 10/18/2017 |
Sami |