Sql server format date

This article is tagged with: Sql server format date and mysql

sql server format date

convert (varchar , getdate()-1 , 112)

sql time format

DATE - format YYYY-MM-DD
DATETIME - format: YYYY-MM-DD HH:MI:SS
TIMESTAMP - format: YYYY-MM-DD HH:MI:SS
YEAR - format YYYY or YY

sql date format

SELECT DATE_FORMAT("2017-06-15", "%Y");

sql server convert date to string yyyymmdd

DECLARE @v DATE= '3/15/2013'
SELECT CONVERT(VARCHAR(8), @v, 112)

This article is tagged with: Sql server format date and mysql