DATEADD(day, -7, GETDATE()) – Does it take time into account?

I am writing a SQL query in Aginity through Amazon Redshift to extract the last 7 days of data. The Date column which I am calling is in the variable type:

DATE

  • Design Database - Best Practice
  • Variable not showing value in Script task in ssis
  • SQL Server: Using CHARINDEX to parse multiplying problems
  • OLe DB provider “SQLNCLI” for linked server was unable to begin a distributed transaction
  • How Do I Script a Database To a Text File So That It Can Be Created Again By Anyone?
  • Last non Null in a Pivot SQL query
  • An example output is this:

    5/30/2017 0:00

    When I call the below function, does it matter what time of day I run this query or will it always take the full day’s worth of data?

    WHERE Date >= DATEADD(day,-7, GETDATE())

  • Extracting 6-8 digit dates from alphanumeric fields
  • MSSQL 2012 : PIVOT typologies and dates using PHP
  • How do I get the date from a datetime when creating a SQL view?
  • Identify rows where time difference is insufficient SQL Server 2008 R2
  • find a date between two dates in T SQL
  • Date serial in SQL?
  • One Solution collect form web for “DATEADD(day, -7, GETDATE()) – Does it take time into account?”

    Yes, this includes the current time component when subtracting 7 days. To get rid of that, convert to a date:

    WHERE Date >= CAST(DATEADD(day, -7, GETDATE()) as DATE)
    
    MS SQL Server is a Microsoft SQL Database product, include sql server standard, sql server management studio, sql server express and so on.