Comparing results with today's date?

前端 未结 10 1709
情深已故
情深已故 2020-12-08 09:15

Is there a way to use the Now() function in SQL to select values with today\'s date?

I was under the impression Now() would contain the ti

10条回答
  •  爱一瞬间的悲伤
    2020-12-08 09:38

    Just zero off the time element of the date. e.g.

    SELECT DATEADD(dd, DATEDIFF(dd, 0, getdate()), 0)
    

    I've used GetDate as that's an MSSQL function, as you've tagged, but Now() is probably MySQL or you're using the ODBC function call, still should work if you just replace one with the other.

提交回复
热议问题