published
is timestamp with time zone
stored as UTC.
gps_coordinates
is geography(Point,4326)
.
SELECT
ST_MakeLine(pp.Gps_Coordinates::geometry ORDER BY pp.Published) As DailyRoute,
pp.Published::date As DayOf
FROM xxxx As pp
WHERE pp.Id = 'xxxxxxxx'
GROUP BY DayOf
I am trying to get all of the data for the Id by day but in the timezone of the person who requested it, so if in CST everything that happened between 00:00:00 CST and 23:59:59 CST, or if in EST everything that happened between 00:00:00 EST and 23:59:59 EST.
What is the best way to rework this query to get the data using this information?
When I tried:
SELECT
ST_MakeLine(pp.Gps_Coordinates::geometry ORDER BY pp.Published) As DailyRoute,
pp.Published::date AT TIME ZONE 'CST' As DayOf
FROM xxxx As pp
WHERE pp.Id = 'xxxxxxxx'
GROUP BY DayOf
The dayof results in 2018-11-25 18:00:00
, this is not what I want. I want to group by everything during the day based on the time of day in the Local Time Zone.