Control timezones

85 views
Skip to first unread message

Lior W.

unread,
Apr 23, 2016, 5:43:54 AM4/23/16
to PocketMath API
Each PocketMath username has a timezone setting. Likewise, each report has a timezone setting.
But the API can't compete with that since it has no timezone setting.
Please give it a timezone setting it.

I assume it mainly affects the reporting queries.

Ross Finch

unread,
Apr 24, 2016, 11:24:23 PM4/24/16
to PocketMath API
Thanks for using the question.

The APIs use ISO-8601 for date and time formats. Part of that standard is the inclusion of the time zone offset from UTC (more details). The Z at the end of the times we use as examples in the documentation refers to Zulu time and corresponds to UTC. So to include a timezone in any of the dates you pass to the API simply remove the Z and give the + or - to UTC. For example for a +12:00 timezone:

curl -X GET --header 'Accept: application/json' --header 'Authorization: Token token=be4ae0d2f91124c356e391cfbf7bd607beb6389a86c42ef010b39c5ccd0a8c01' 'https://api.pocketmath.com/v2/stats/orders.json?from=2015-10-28T00%3A00%3A00.000%2B12:00&to=2015-10-30T00%3A00%3A00.000%2B12:00'

Lior W.

unread,
May 5, 2016, 1:30:33 PM5/5/16
to PocketMath API
Very nice!
Can you please document it in the site itself next to the API reference?
Thanks.

Lior W.

unread,
May 5, 2016, 1:45:59 PM5/5/16
to PocketMath API
Actually, I've just tried and it doesn't seem to work. I've even copied and pasted your direct example and the results are in Z (Zulu).

Try it on the hourly stats v2/orders/130303/stats/hourly.json where it's easy to see times.

Ross Finch

unread,
May 6, 2016, 12:04:16 AM5/6/16
to PocketMath API
Returned results will be in Zulu time with the required offsets already applied.

For example if i do this:



The result will be in in Zulu time with the 8 hour difference already applied:


2015-10-28T00:00:00.000+08:00 is the same as 2015-10-27T16:00:00.000Z.


We will be looking at updating the documentation in soon, thanks for the suggestion.


Reply all
Reply to author
Forward
0 new messages