Home
Manage Your Code
Snippet: SQL Date Only (SQL)
Title: SQL Date Only Language: SQL
Description: SQL DateOnly, StartofWeek, EndOfWeek. Removes time from the Date object. Views: 678
Author: David Speight Date Added: 10/26/2011
Copy Code  
-- Date Only (Strips time)
SELECT DATEADD(day, DATEDIFF(day, 0, CURRENT_TIMESTAMP), 0) AS DATEONLY

-- First Date in the week
SELECT DATEADD(wk, DATEDIFF(wk, 6, CURRENT_TIMESTAMP), 6) AS START_OF_WEEK 

-- Last Date in the week
SELECT DATEADD(wk, DATEDIFF(wk, 6, CURRENT_TIMESTAMP), 6 + 6) AS END_OF_WEEK 
Usage
SQL Dates - DateOnly, StartofWeek, EndOfWeek
Notes
DateOnly, StartofWeek, EndOfWeek