jdate Calculations

Status
Not open for further replies.

bespokeappstt

Hubstaff freelancer
I'm calculating the difference in days with a jdate plugin. The following works fine within the month:
Code:
$date2 = strtotime('{rad_rentals___due_date_out_raw}');
$date3 = strtotime('{rad_rentals___due_date_in_raw}');
return (ceil(($date3 - $date2) / 86400))+1;
But I get an extra day when is not the same month. Once $date2 and $date3 are within the same month, the calculation is good. Once its different months I get an extra day. How can I modify the calculation to get the correct days across months? jdate gives the epoc time? Couldn't get much info on jdate from the wiki.
 
What exactly is the jdate plugin? If I knew more about it, I can get what is the month for each jdate and do a calculation from there.
 
Thank you very much for that link. Mathematically it should be the same but for some strange reason I'm getting the results I want now. I am now using:
Code:
$date2 = strtotime('{rad_rentals___due_date_out_raw}');
$date3 = strtotime('{rad_rentals___due_date_in_raw}');
$dateDiff = $date3 - $date2;
return round($dateDiff / 86400)+1;

SOLVED.
 
Status
Not open for further replies.
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top