The UTC range for 2023 starts at 1672531200 and ends at the exclusive boundary 1704067200. The year has 365 days.

Use the year as a half-open range

WHERE event_time >= 1672531200
  AND event_time <  1704067200

The exclusive upper boundary is safer than “December 31 at 23:59:59.” It works whether the database stores whole seconds, milliseconds, or fractions of a second.

Month starts in UTC

Month start Unix seconds ISO 8601 UTC
January 1 1672531200 2023-01-01T00:00:00Z
February 1 1675209600 2023-02-01T00:00:00Z
March 1 1677628800 2023-03-01T00:00:00Z
April 1 1680307200 2023-04-01T00:00:00Z
May 1 1682899200 2023-05-01T00:00:00Z
June 1 1685577600 2023-06-01T00:00:00Z
July 1 1688169600 2023-07-01T00:00:00Z
August 1 1690848000 2023-08-01T00:00:00Z
September 1 1693526400 2023-09-01T00:00:00Z
October 1 1696118400 2023-10-01T00:00:00Z
November 1 1698796800 2023-11-01T00:00:00Z
December 1 1701388800 2023-12-01T00:00:00Z

Quarter boundaries

  • Q1: 1672531200 (2023-01-01T00:00:00Z)
  • Q2: 1680307200 (2023-04-01T00:00:00Z)
  • Q3: 1688169600 (2023-07-01T00:00:00Z)
  • Q4: 1696118400 (2023-10-01T00:00:00Z)
  • Next year: 1704067200 (2024-01-01T00:00:00Z)

These are UTC values. If the business timezone is not UTC, its local year begins at a different instant; calculate those boundaries in the named location before storing the result.