mardi 26 avril 2016

SQL Server - 2008 Format vs Convert

I've always used convert for date formatting, see below. As a new SQL user I see that you can also use FORMAT, see below. I realize that convert function converts your data into a string but when date formatting which is best to use?

FORMAT(getdate(), 'MM/dd/yy') AS [MM/DD/YY],
CONVERT(VARCHAR(8), getdate(), 1) AS [MM/DD/YY]

Aucun commentaire:

Enregistrer un commentaire