|
|
Question : How to format sql date convert(varchar, getdate(),101) to surpress leading 0's
|
|
If I have a date in a sql table 1900-01-01 00:00:00.000 how do I display it as 1/1/1900?
The below statement returns: 01/01/1900. select convert(varchar, getdate(),101)
Sql 2000
|
Answer : How to format sql date convert(varchar, getdate(),101) to surpress leading 0's
|
|
in short: cast(datepart(month, getdate()) as varchar(2)) + '/' + cast(datepart(day, getdate()) as varchar(2)) +'/' + cast(datepart(year, getdate()) as varchar(2))
|
|
|
|
|