Magento – Magento 2 : Wrong order created and updated date in rest api response

apimagento2ordersresttimezone

I am fetching the orders using Magento 2 REST api services. I am using IST timezone the dates saved in the database are in correct timezone. I have set timezone to "Asia/Kolkata". On customer dashboard and in admin panel orders pages dates are getting displayed in IST. But when I fetch the order using the REST api I am getting the dates in UTC timezone.

"created_at": "2017-08-11 06:04:18" this is what I am getting for created at in response.

2017-08-11 11:34:18 this is what the actual time is saved in database.

Can someone help me here to get the created time in correct timezone?

Best Answer

So it looks like the API always returns the dates in UTC, which is nice if you know it's going to do that, because you can always count on the date being UTC no matter what the magento configuration is set to or changed to.

Related Topic