The release of SQL Server 2022 came with the introduction of the DATE_BUCKET()
function.
The DATE_BUCKET()
function allows us to arrange data into groups that represent fixed intervals of time. It returns the date/time value that corresponds to the start of each date/time bucket, as defined by the arguments passed to the function.