I know how to get in SQL (SQL Server) the current date, but with the beginning of the day:
select dateadd(DAY, datediff(day, 0, getdate()),0)
(result:2009-09-17 00:00:00.000)
I need to get (in SQL) the current date with the beginning of this hour.
For example: 2009-09-17 17:00:00 (I don’t care about the exact format)
and I need to get the current date but with the beginning of this month:
For example: 2009-09-01 00:00:00.000 (I don’t care about the exact format)
Can you help me? Thanks in advance
Just adapt your current start of day code!
All you want is start of month, start of hour. Its just the same…