I get the following error:
PHP Notice: Object of class DateInterval could not be converted to int blabla in rule 128
this is the code (128):
if ( $difference > 30*24*60*60) {
for more information here is a bigger code:
$timeFromMysql = strtotime($createdtime);
$currenTime = SPRequest::now();
function format_interval(DateInterval $interval) {
$result = "";
if ($interval->y) { $result .= $interval->format("%y years "); }
if ($interval->m) { $result .= $interval->format("%m months "); }
if ($interval->d) { $result .= $interval->format("%d days "); }
if ($interval->h) { $result .= $interval->format("%h hours "); }
if ($interval->i) { $result .= $interval->format("%i minutes "); }
if ($interval->s) { $result .= $interval->format("%s seconds "); }
return $result;
}
$first_date = new DateTime($createdtime);
$second_date = new DateTime($currenTime);
$difference = $first_date->diff($second_date);
//echo format_interval($difference);
//echo $createdtime;
//echo $currenTime;
if ( $difference > 30*24*60*60) {
// load the apicall
$xml = simplexml_load_file($api);
}
echos works fine.