datepart for 1st of month sql code example
Example 1: get hour from date sql
SELECT DATEPART(HOUR, GETDATE());
Example 2: sql server beginning of month
SELECT DATEADD(month, DATEDIFF(month, 0, @mydate), 0) AS StartOfMonth
SELECT DATEPART(HOUR, GETDATE());
SELECT DATEADD(month, DATEDIFF(month, 0, @mydate), 0) AS StartOfMonth