how to create datepart function in sql server code example
Example 1: get hour from date sql
SELECT DATEPART(HOUR, GETDATE());
Example 2: datepart day of week
SELECT DATENAME(DW,'2007-10-30');
SELECT DATEPART(HOUR, GETDATE());
SELECT DATENAME(DW,'2007-10-30');