API With Time zone

Titaporn
New Member
2 0 0

HI all
Now I am working on consuming data from shopify via rest api admin
So, on my setting shop 
"created_at": "2018-09-17T07:28:00-04:00",
"updated_at": "2018-10-01T05:31:50-04:00",
"country_code": "TH",
"country_name": "Thailand",
"currency": "THB",
"customer_email": "pmo@acommerce.asia",
"timezone": "(GMT-05:00) America/New_York",
"iana_timezone": "America/New_York", 
... 

this url I have been used 
https://acomstaging.myshopify.com/admin/orders.json?updated_at_min=2018-10-08T00:00:00-04:00&updated...
This AIP correct or not?
{
    "orders": [
        {
            "id": 662753706097,
            "email": "test@gmail.com",
            "closed_at": null,
            "created_at": "2018-10-08T00:46:47-04:00",
            "updated_at": "2018-10-08T00:46:48-04:00",
            "number": 19,
...

actually, I maintain 5 shops in a different time zone. So
1. I would like to know can I use UTC to get API or not?
2. if can use API without UTC time could you give me an example to using API for a specific time zone and without time zone 
3. My time zone is  GMT-05:00  why  created_at: 2018-09-17T07:28:00-04:00  using -04:00
4. Are they have time life-saving?

 Regards,
Titaporn

Replies 4 (4)
Zameer
Shopify Staff (Retired)
295 31 80

Hey Titaporn,

Zameer here from the Shopify Developer Experience team!

Orders retrieved with the API include whatever timezone is set as the default for the shop. You can access and adjust each store's timezone by going to the shop Admin > Settings > General > Standards and formats. 

Although it's not possible to request orders with times in the UTC format unless the shop timezone is UTC, you can do the time conversion for each shop based on its specific timezone. A shops timezone can be retrieved from the '/admin/shop.json' endpoint.

The reason you are seeing the created_at time for the order on September 17th with a -04:00 timezone is because of Daylight Savings Time (DST). Shopify automatically corrects for Daylight Savings Time based on the date each order is placed. For example, if you search for an order placed on November 10th (after DST), the created_at time will have the appropriate --5:00 EST timezone and not the -04:00 EDT timezone.

Hopefully, that helps clarify!

Titaporn
New Member
2 0 0

HI Zameer 

Thank you for your help
1. Do you have any way that let me know when Is Daylight Savings Time (DST) for example do you have an API to get Daylight Savings Time (DST) from the shop?
If don't have any way to get DST. How we cell API during Daylight Savings Time (DST)?
ex My shop 
"timezone": "(GMT-05:00) America/New_York",
I know that timezone -05:00 then I will cell API on  2018-10-08   (this day is during DST) 
how can I get DST for API

Regards,
Titaporn

Zameer
Shopify Staff (Retired)
295 31 80

Hey Titaporn,

You can retrieve the timezone of the shop from the /admin/shop.json endpoint.

 

elachino
Tourist
5 1 0

Hi, i retrive GMT +01:00 timezone, but my orders was saved with +02:00, do you know how is it possible?

Below my shop.json data

"shop": {
"created_at": "2019-03-21T16:45:57+01:00",
"updated_at": "2019-06-25T00:02:21+02:00",
"timezone": "(GMT+01:00) Europe/Rome",
"iana_timezone": "Europe/Rome",
"weight_unit": "kg",
"province_code": "PR",