Quick Reference to SQL Server Date Formats
Just stumbled upon this site that has a great list of common SQL Server date formats. It’s never easy in SQL to format dates, but with this list, it should be simple.
This also includes 3 simple ways to get JUST the date portion of a datetime field. When you’re just starting with SQL, this is about the most common question.
CAST(CONVERT(VARCHAR(10), @pInputDate, 111) AS DATETIME)
CAST(CAST(YEAR(@pInputDate) AS VARCHAR(4)) + '/' +
CAST(MONTH(@pInputDate) AS VARCHAR(2)) + '/' +
CAST(DAY(@pInputDate) AS VARCHAR(2)) AS DATETIME)
CAST(FLOOR(CAST(@pInputDate AS DECIMAL(12, 5))) AS DATETIME)
http://www.sql-server-helper.com/tips/date-formats.aspx
Recent Buzz