Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

We're moving the community! Starting July 7, the current community will be read-only for approx. 2 weeks. You can browse content, but posting will be temporarily unavailable. Learn more

GraphQL Timezone Difference

GraphQL Timezone Difference

edwinv
Tourist
4 0 3

Hi,

 

I've started using the Admin GraphQL instead of the Admin Rest API and I am having some trouble getting orders data. In my store, the order's processedAt date is recorded in GMT-5. When querying with the Rest API I can just specify -5:00  (EST) and I can pull the date as it appears on the store. When I use the GraphQL API and specify -5:00 (EST), it pulls the correct orders but the timestamp is set to UTC. Is there a way to set it to EST like how the Rest API and store presents it or would I have to process that separately? 

 

Thanks in advance!


 

 

'''
        {
            orders(first:8, reverse:true, query:"processed_at:2022-06-08T00:00:00-5:00"){
                pageInfo{
                    hasNextPage
                }
                edges {
                    node {
                        processedAt
                        createdAt
                    }
                }
            }
        }
        '''
{
  "data": {
    "orders": {
      "pageInfo": {
        "hasNextPage": true
      },
      "edges": [
        {
          "node": {
            "processedAt": "2022-06-09T03:08:47Z",
            "createdAt": "2022-06-09T03:08:48Z"
          }
        },
        {
          "node": {
            "processedAt": "2022-06-09T01:44:42Z",
            "createdAt": "2022-06-09T01:44:43Z"
          }
        },
        {
          "node": {
            "processedAt": "2022-06-09T00:52:09Z",
            "createdAt": "2022-06-09T00:52:10Z"
          }
        },
        {
          "node": {
            "processedAt": "2022-06-09T00:14:12Z",
            "createdAt": "2022-06-09T00:14:13Z"
          }
        },
        {
          "node": {
            "processedAt": "2022-06-09T00:13:53Z",
            "createdAt": "2022-06-09T00:13:55Z"
          }
        },
        {
          "node": {
            "processedAt": "2022-06-09T00:03:56Z",
            "createdAt": "2022-06-09T00:03:58Z"
          }
        },
        {
          "node": {
            "processedAt": "2022-06-08T23:17:11Z",
            "createdAt": "2022-06-08T23:17:14Z"
          }
        },
        {
          "node": {
            "processedAt": "2022-06-08T23:04:33Z",
            "createdAt": "2022-06-08T23:04:35Z"
          }
        }
      ]
    }
  },
  "extensions": {
    "cost": {
      "requestedQueryCost": 10,
      "actualQueryCost": 10,
      "throttleStatus": {
        "maximumAvailable": 2000.0,
        "currentlyAvailable": 1990,
        "restoreRate": 100.0
      }
    }
  }
}

 

 

 

Replies 3 (3)

JamesG
Shopify Staff
42 10 11

Hi @edwinv 

It looks like you need to add another set of quotation marks around the inner datetime string. You can see an example with the created_at filter in our search syntax guide, but I would recommend trying something like this:

{
  orders(first:8 reverse:true query:"processed_at:>'2022-06-08T00:00:00-5:00'") {
    nodes {
      id
    }
  }
}

 

JamesG | API Support @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

edwinv
Tourist
4 0 3

Hi James,

 

added another set of quotation marks around the inner datetime string and the results were still in UTC, while my store displays EST (GMT-5).
For the time being I will adjust the time zone after pulling the data.
Thank you for your response!

mattread6
Shopify Partner
3 0 0

Hey @edwinv and @JamesG - Did you guys ever come to a solution? I have a shopifyQL query I am posting to the graphQL and wanted to get the table results back in eastern time at a daily granularity. Wanted to see if you guys solved for this already!