Loading src/Utilities.php +21 −0 Original line number Diff line number Diff line Loading @@ -136,4 +136,25 @@ class Utilities { )); } /** * Converts a Unix timestamp to an ISO 8601 date as expected by the SP-API. * * @param int $timestamp * The Unix timestamp to convert. * * @return string * The time in ISO 8601 format and in UTC timezone. * * @I Validate that the input is a Unix timestamp * type : bug * priority : normal * labels : validation */ public static function timestampToIso8601($timestamp) { $datetime = new \DateTime('now', new \DateTimeZone('UTC')); $datetime->setTimestamp($timestamp); return $datetime->format('Y-m-d\TH:i:s') . 'Z'; } } Loading
src/Utilities.php +21 −0 Original line number Diff line number Diff line Loading @@ -136,4 +136,25 @@ class Utilities { )); } /** * Converts a Unix timestamp to an ISO 8601 date as expected by the SP-API. * * @param int $timestamp * The Unix timestamp to convert. * * @return string * The time in ISO 8601 format and in UTC timezone. * * @I Validate that the input is a Unix timestamp * type : bug * priority : normal * labels : validation */ public static function timestampToIso8601($timestamp) { $datetime = new \DateTime('now', new \DateTimeZone('UTC')); $datetime->setTimestamp($timestamp); return $datetime->format('Y-m-d\TH:i:s') . 'Z'; } }