How to include daylight hour change in a query so it gives 25 hours, or 23 in a day instead of 24

Viewed 32

In DB ( Postgres / TimescaleDB ), I have a measure each 30min. So, it means in a normal day, I have 48 measures. Timestamp is stored with type "timestamp without timezone"

Now, for the 2 special days where we change CDT in France ( 2020-10-25 and 2021-03-28 ), I should have respectively have 50 and 46 measures.

But when I query :

    $measuresByTS = Measure::where('time', '>=', $from)
        ->where('time', '<=', $to)
        ->...

I always get 48 measures which is logical, but not what I want.

How should I get the 46 or the 50 measures on thoses 2 days ? Is there any TimescaleDB function that manages that ?

Here is what I should get:

when 46 measures:

I should have measures from 2021-03-28T23:00:00Z to 2021-03-28T21:30:00Z (formatted in french TZ)

when 50 measures:

I should have measures from 2021-03-28T22:00:00Z to from 2021-03-28T22:30:00Z(formatted in french TZ)

How should I do it ???

0 Answers
Related