SQL Server has lots of date functions; can you pick the right one? Quiz 27 of 31, built from a question in my SQL Server Interview Questions and Answers book.
SQL SERVER – DATEDIFF – Accuracy of Various Dateparts
Why does DATEDIFF say 1 minute between two times only 3 seconds apart? It is not a bug. Here is how DATEDIFF counts datepart boundaries.
SQL SERVER 2012 – DateTime Functions – DATEFROMPARTS() – DATETIMEFROMPARTS() – DATETIME2FROMPARTS()
SQL Server 2012 adds seven new datetime functions, such as DATEFROMPARTS, DATETIMEFROMPARTS and EOMONTH. A quick look at building dates from their parts.
SQL SERVER – Information Related to DATETIME and DATETIME2
A reader comment explains the precision issue between DATETIME and DATETIME2: values lose precision when converted between types. Here is the workaround.
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.






