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

Shrink Image (JavaScript)

Text Clips for Programmers Notepad 2 (XHTML)