Tag history stores tag value with wrong timestamps

image
image
image

Problem:
I have a string tag with history enabled that stores string value in the DB table. When I call this table to show data then it shows wrong time. As it can be seen in the image 2 the gateway time is different and in image 3 the timestamp it shows is different. The named query is attached in the last image. What is the issue? The time is running behind 12 hrs.

Is your database on a different machine?

Yes

Check the time settings of the gateway machine vs the database machine.