Handle leap years in T-SQL with date functions, test February boundaries, and choose a clear anniversary rule for February 29 births.
DATE_BUCKET: Align 15-Minute Windows With an Origin
DATE_BUCKET uses an origin to align reporting windows. Keep width, unit and origin explicit while checking timestamps around each boundary.
datetime2 Precision: Rounding Can Cross Midnight
datetime2 precision changes can round into the next second or date. Compare typed seven-digit values with millisecond and whole-second conversions.
Inclusive End Dates: Why BETWEEN Misses the Last Day
Inclusive end dates describe whole calendar days, while BETWEEN compares the exact supplied endpoints. A date endpoint becomes midnight when compared with timestamp rows. A guarded disposable fixture makes the boundary conditions explicit.
SQL SERVER – Datetime Function TODATETIMEOFFSET Example
A quick example of the datetime function TODATETIMEOFFSET in SQL Server, and how it differs from SWITCHOFFSET when offsets change.
SQL SERVER – Datetime Function SWITCHOFFSET Example
SWITCHOFFSET changes a datetimeoffset value from its stored time zone offset to a new one. Here is a quick example of how it works in SQL Server 2008.
SQL SERVER – Difference Between DATETIME and DATETIME2 – WITH GETDATE
I repeat my DATETIME and DATETIME2 test with GETDATE instead of SYSDATETIME. See how the distinct values in each column compare this time.







