Reputation: 43
I have a Varchar data type in my Sql Server table. It is used for saving Date and time in IST as string.
For e.g Sat Sep 01 2012 09:00:00 GMT+0530 (India Standard Time)
Can any one please help me in converting this string into Sql Server Datetime Type, using sql query.
Upvotes: 0
Views: 835
Reputation: 24046
try this:
declare @dt varchar(50)='Sat Sep 01 2012 09:00:00 GMT+0530'
select CONVERT(datetime,substring(@dt,5,20))
Upvotes: 1