Grouping by a Calendar Day in a Time Zone
A daily report needs a calendar zone when stored observations are instants. The same instant can fall on different dates in different zones.
- Source
- Anbloq
- Language
- English
- Created
- Updated
- Chapters
- 4
- Reading time
- 1 min
In this article4 chapters
Trace near midnight
A late evening event in one zone may already be tomorrow in another. Convert under the report's chosen zone before grouping. Calendar dates and instants describe the stored values.
Check the day interval
For selecting one local date, build its start and next day's start under the zone rather than assume every day has twenty-four elapsed hours. Half-open bounds describe including the start and excluding the next.[1]
Convert an instant before extracting a calendar date
A record stored at 23:30 UTC on Monday belongs to Tuesday in a location whose offset is plus two hours at that instant. A report grouping by local calendar day should convert to the selected zone while preserving the underlying instant. See instant and local date.
UTC observed day: Monday
Local time under +02:00: Tuesday 01:30
Group choice changes the bucket
Test daylight rules and boundary crossing
An offset for one instant need not apply throughout the year in a named zone. Use the database's supported zone conversion and include two records separated by a local midnight.