Reputation: 563
In database, the table-> date column showing the correct date and time.
in database table column :
2020-08-25 04:00:32.217609
But when I am fetching the same date, it's showing the exactly 24 hrs old date and time.
fetched from database :
2020-08-24T16:00:32.217Z
I think it's about local timezone and also the format is different when fetching. I am trying to understand the issue and then looking for solution.
Note: I am fetching the data using typeorm queryBuilder.
Upvotes: 0
Views: 639
Reputation: 164829
Yes, they are the same time in different time zones. The first is in your local time zone (New Zealand Standard Time) 12 hours ahead of UTC. The Z
at the end of the second indicates it is in UTC, 12 hours behind you.
The other difference is in the fractional seconds. Your database is storing in microseconds. Your program is storing in milliseconds, or only displaying milliseconds.
Upvotes: 1