GETDATE()

Assume the database table only has a date format in YYYY-MM-DD, not including the time as in the screenshot on the right. There’s a slight adjustment to the query below to ensure it runs:

SELECT *

FROM database_table

WHERE date = CONVERT(date, GETDATE())

  • Here, we use the CONVERT() SQL function to convert the GETDATE() output (that by default includes the current time) and only returns the YYYY-MM-DD data from it. The CONVERT(date, input) function converts the input to the date format in SQL to ensure we will match our database table’s setup with the data we’d like to convert.