1

I need to convert May 8 2014 to this format 08/05/2014.

I tried using:

convert(char(12),"May 8 2014",103) 

but it did not work.

Kindly suggest a workaround.

Tim
  • 41,901
  • 18
  • 127
  • 145
Prateek Gupta
  • 135
  • 1
  • 2
  • 11

2 Answers2

2

Try to convert the string to datetime, and than you should convert it to char as below:

select convert(char(12),cast("May 8 2014" as datetime) ,103) 
Robert
  • 25,425
  • 8
  • 67
  • 81
0

Another implementation of same approach , i.e., first convert to datetime:

select convert(char(12),convert(datetime,"May 8 2014") ,103)

crizzo
  • 31
  • 5