Result: 2019
SELECT DATEPART(yyyy, '2019/04/28');
Result: 2019
SELECT DATEPART(yy, '2019/04/28');
Result: 2019
SELECT DATEPART(month, '2019/04/28');
Result: 4
SELECT DATEPART(day, '2019/04/28');
Result: 28
SELECT DATEPART(quarter, '2019/04/28');
Result: 2
SELECT DATEPART(hour, '2019/04/28 09:49');
Result: 9
SELECT DATEPART(minute, '2019/04/28 09:49');
Result: 49
SELECT DATEPART(second, '2019/04/28 09:49:12');
Result: 12
SELECT DATEPART(millisecond, '2019/04/28 09:49:12.726');
Result: 726
Previous article: DATENAME function in SQL Server
Next lesson: DAY function in SQL Server