Question

I've got a select query that returns a list of rows that have expired

  SELECT *
  FROM dbo.myTable
  WHERE  endDate < Convert(datetime, Convert(int, GetDate()))

how can I get it to use current day at 2AM instead of the current time I get from GetDate()

Was it helpful?

Solution

To get the current day at 2AM:

convert(datetime,left(convert(varchar, getdate(), 121),10) + ' 02:00')
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top