I am facing an interesting problem in php. In my project, for calculating date difference i am using date time object diff method. The problem is, in two script for common case the program return different result. I don't understand what is the reason for the scenario. Here is the code snippet.
$DTObj = new DateTime();
$pdate = DateTime::createFromFormat("ymd", 141118);
$diff = $DTObj->diff($pdate);
$dday = $diff->format("%a");
print_r($dday);
In one script it return 4 and another script return 5. Note: My system time 2014-11-23. I highly appreciate any idea for solving this problem. Thanks in advance.