I am working on creating a custom module to show orders report in admin. Right now I have fetched data from 'sales_order' table using sql query. I know I should not use sql queries to fetch data from database rather I should use magento collection object to fetch the data. But right now I am just checking and will update my code in future and will use magento way to fetch data.
So while fetching the data using sql query the time that it shows for created_at time is different than the time that is saved in database.
This is the screenshot of the time saved in database.
While fetching in the frontend the time is different. This is the sql query that I am using
And this is the data that I received.
I have marked the increment_id and we can see that the id is same, but the time that I received in the array is different than the database.
And also the time in the sales order grid in admin is matching with the database time.
So my question is why the time that I have fetched using sql query is different than the one in the database and how I can correct it. Plz could someone guide me in this.