Convert Date to ISO (SQL Server)

To convert a date column into ISO format (YYYY-MM-DD) using SQL, the following code can be used:

LEFT(CONVERT(char(10), DateColumn, 126), 10) AS DateFormatted

Or using '/' as the seperator:

REPLACE(LEFT(CONVERT(char(10), DateColumn, 126), 10), '-', '/') AS DateFormatted

Comments

Popular posts from this blog

Select box manipulation with jQuery

iTextSharp: Generating a Basic PDF file (ASP.NET/C#)

Popup Window Countdown (JavaScript)