sql server convert date to string MM/DD/YYYY

Nate Pet picture Nate Pet · Aug 8, 2012 · Viewed 226.6k times · Source

I am using SQL Server 2008.

I have the following:

    select convert(varchar(20),fmdate) from Sery

How do I convert the date to string such that it show as MM/DD/YYYY

Answer

TFD picture TFD · Aug 8, 2012

That task should be done by the next layer up in your software stack. SQL is a data repository, not a presentation system

You can do it with

CONVERT(VARCHAR(10), fmdate(), 101)

But you shouldn't