/** * Static method that returns a timestamp after applying a time * difference to it. * * @static * @param timeStamp The original ISO timestamp * @param timeDiff The time difference that we'd like to apply to the * original timestamp */ function getDateWithOffset($timeStamp, $timeDiff) { if ($timeDiff != 0) { $t = new Timestamp($timeStamp); // // we can't use the addSeconds method with a negative offset // so we have to check wether the offset is positive or negative // and then use the correct one... // if ($timeDiff > 0) { $t->addSeconds($timeDiff * 3600); } else { $t->subtractSeconds($timeDiff * -3600); } $date = $t->getTimestamp(); } else { $date = $timeStamp; } return $date; }