There are records in the database where, in UTC they are March 13th. But in my time zone, they are March 12th. What I would like to do… is have postgres convert the created_at fields to MST before querying these records.
When I enter March 12 for the search date, I don’t get all of the data that I should be getting, because a bunch of the records appear as if they were entered on march 13 (in UTC that is true, but if you convert these to MST then their date is march 12th)
Here’s an example:
In the database, a record has this timestamp: Sat, 13 Mar 2021 00:54:55 UTC +00:00
If you run this timestamp through the
date() function, the date returned is 2021-03-13… because it’s UTC. This timestamp is actually March 12th though if you convert it to MST! So when I search for records on the 12th… I don’t get everything from the 12th! Because the records are stored in UTC.
I don’t know how else I can explain it, lol.
When you take: Sat, 13 Mar 2021 00:54:55 UTC +00:00
and convert it to MST you get: 2021-03-12 17:54:55.914387 -0700
So you get completely different results when you run these two through the
I need postgres to treat the query as if
created_at fields are actually MST.