Which Timezone is correct for the Timestamps?

Which Timezone is correct for the Timestamps?

in API Development

Posted by: MuhQ.8012

MuhQ.8012

Hey there,

im currently working with the /pvp/games endpoint to archive data about my played matches. The endpoint returns “started” and “ended” as ISO 8601 with the flag ‘Z’ at the end to declare it is in UTC.
Example:

"started":"2015-11-08T10:09:24.000Z",
"ended":"2015-11-08T10:20:13.000Z"
This specific match was played at about 2:55 CET or 1:55 UTC. The timestamp the API returns however is far in the future and even seems to return “wrong minutes”.

Do I misunderstand the format or does the API send wrong timestamps? How do other users work with this?

Which Timezone is correct for the Timestamps?

in API Development

Posted by: Tao Ythaq.6582

Tao Ythaq.6582

Yes, this is an issue known for month.

Substract 8 hours to have the correct date.

I hard coded that in my GW2 Api client :

https://github.com/arnapou/gw2apiclient/blob/master/src/Arnapou/GW2Api/Model/PvpGame.php

    /**
     * 
     * @return string
     */
    public function getDateStarted() {
        return gmdate('Y-m-d H:i:s', strtotime($this->data['started']) - 8 * 3600);
    }
    /**
     * 
     * @return string
     */
    public function getDateEnded() {
        return gmdate('Y-m-d H:i:s', strtotime($this->data['ended']) - 8 * 3600);
    }