T-SQL 101: 59 Extracting date and time components in SQL Server T-SQL using DATEPART
In an earlier post, I showed how you can use the YEAR, MONTH, or DAY functions to extract those parts of a date. But what if you want to extract any one of those other intervals?
Well, that’s what the DATEPART function does. It allows us to specify the interval that we want to extract. Look at the following query examples:

And here are the results of that query:
2020-03-02

