$dtStart=new DateTime($item["start"]["dateTime"]);
$dtEnd =new DateTime($item["end"]["dateTime"]);
$dtStGoogle= new DateTime($event->start->dateTime);
$dtStGoogle->setTimezone(new DateTimeZone("America/Chicago"));
$dtEndGoogle=new DateTime($event->end->dateTime);
$dtEndGoogle->setTimezone(new DateTimeZone("America/Chicago"));
$dtDiffStart=$dtStart->diff($dtStGoogle);
$dtDiffEnd=$dtEnd->diff($dtEndGoogle);
I am using PHP 5.6.13 and now 5.6.14 Then I try to compare them and the result is either always true or always false regardless of the value.
if ($dtDiffEnd) { printf("<br> Start Date time are different %d %d %d %d %d %d ",$dtDiffStart->m,$dtDiffStart->d,$dtDiffStart->y,$dtDiffStart->h,$dtDiffStart->m,$dtDiffStart->s);} incorrect
if (!$dtDiffEnd) { same as above} incorrect
if ($dtStart!=$dtStartGoogle) {same as above} incorrect
if ($dtStart!==$dtStartGoogle) {same as above} incorrect
Either I get results with values of 0 0 0 0 0 0 (always true) or none (always false) at all and both are incorrect. I have tried other crazy things with the same results.
I have tried everything I can think of, anyone know what I am doing wrong?
This works, but there has got to be a simplier way:
if ((($dtDiffEnd->m!=0) || ($dtDiffEnd->d!=0) || ($dtDiffEnd->y!=0) || ($dtDiffEnd->h!=0) || ($dtDiffEnd->i!=0) || ($dtDiffEnd->s!=0)))
any advice appreciated.