SQL Reporting Services Tips  

Main | About us | Contact us  

 

21) Stripping the time off a Datetime field (SQL)

Use the following SQL expression:

DECLARE @CurrentDate DATETIME

SET @CurrentDate = GETDATE()

SELECT @CurrentDate AS DateWithTime

,CAST(CONVERT(VARCHAR(10), @CurrentDate, 121) AS DATETIME) AS DateWithoutTime

© Copyright 2009. Reporting Services Tips.