sql server - How to convert DateTime to VarChar with specific format, without using string functions? -


this question has answer here:

i wanna convert datetime varchar.

it seams dublicated question

but wait minute.

the next link awesome:

how convert datetime varchar

but not effect question.

my output neer format 101

convert(varchar(10), [mydatetimecolumn], 101) 

output:

04/21/2000 

i wanna output without 0 in month

requested output

4/21/2000 

is applicable, without using string function (like substring, replace, ... etc) ?

updated requested code should runnable on sqlserver2005, sqlserver2012 & sybase

if using sql 2012 or higher can achieve using format function native sql.

format(yourdate, 'm/dd/yyyy') 

Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -