I have a table like the image below and if you notice the first row has a timestamptz
value of "2023-08-13 11:31:33.013 +0000"
. My issue is, I need the records to show up for the user if they query for the date range between:
'2023-08-12T00:00:00.000Z' AND '2023-08-12T23:59:59.999Z'
and neither has worked as intended. The Postgresql instance is set to UTC time zone as well and it hasn't affected anything.
Currently I have tried these 2 approaches:
Approach #1.
AND vs.created_at AT TIME ZONE 'America/New_York'
BETWEEN ('2023-08-12T00:00:00.000Z' AT TIME ZONE 'America/New_York')
AND ('2023-08-12T23:59:59.999Z' AT TIME ZONE 'America/New_York')`
Approach #2:
AND vs.created_at AT TIME ZONE 'UTC' AT TIME ZONE 'America/New_York'
BETWEEN ('2023-08-12T00:00:00.000Z' AT TIME ZONE 'UTC' AT TIME ZONE 'America/New_York')
AND ('2023-08-12T23:59:59.999Z' AT TIME ZONE 'UTC' AT TIME ZONE 'America/New_York')
I was expecting the first one to work.