0
考虑这两个日期2017年4月14日,2017年6月3日PHP的date_diff函数被破坏了吗?
使用的PHP date_diff给了我这个
object(DateInterval)[6]
public 'y' => int 0
public 'm' => int 1
public 'd' => int 20
public 'h' => int 0
public 'i' => int 0
public 's' => int 0
public 'weekday' => int 0
public 'weekday_behavior' => int 0
public 'first_last_day_of' => int 0
public 'invert' => int 0
public 'days' => int 50
public 'special_type' => int 0
public 'special_amount' => int 0
public 'have_weekday_relative' => int 0
public 'have_special_relative' => int 0
我创建这个函数的重复的任务(作为转让)。但是,当我通过我的算法运行这些日子我得到
object(stdClass)[4]
public 'years' => int 0
public 'months' => int 1
public 'days' => int 19
public 'total_days' => int 50
public 'invert' => int 0
当我用手工计算的天数(手动),我仍然认为这是额外的19天。我不在寻找任务解决方案。但也许有些算法或者date_diff函数有一些我不知道的错误?
对于200多个测试用例,我的算法有效,而另外7个则没有,我的解决方案和php解决方案之间总是有一天差异。