Is there a SQL format to remove leading zeros from the date?
Like if the date is 01/12/2015
to present it as 1/12/2015
, and 01/01/2016
should be shown as 1/1/2016
etc
The entire date normally contains dd/MM/yyyy HH:mm:ss
. I need to remove those redundant leading zeroes without changing the rest of information.
Currently I use query containing something like this:
convert(varchar, dateadd(hh, " + 2 + " , o.start_time), 103)) + ' '
left(convert(varchar, dateadd(hh, " + 2 + " , o.start_time), 108), 110)
I'm working with SQL Server 2008
FORMAT
is only available in SQL Server 2012 as a new feature - not available in SQL Server 2008 which is used here – Byproduct