SQL where datetime column equals today's date?

前端 未结 5 597
感情败类
感情败类 2021-01-31 07:08

How can I get the records from a db where created date is today\'s date?

SELECT [Title], [Firstname], [Surname], [Company_name], [Interest] 
FROM [dbo].[EXTRANET         


        
5条回答
  •  不知归路
    2021-01-31 08:01

    Looks like you're using SQL Server, in which case GETDATE() or current_timestamp may help you. But you will have to ensure that the format of the date with which you are comparing the system dates matches (timezone, granularity etc.)

    e.g.

    where convert(varchar(10), submission_date, 102) 
        = convert(varchar(10), getdate(), 102)
    

提交回复
热议问题