August 20, 2012 at 6:19 am
Hi folks,
I have one table and one of its column contains the data in this format.
Thu Jun 14 15:07:06 UTC+0530 2012
I wants to convert this string into DateTime.
Plz suggest what should i do ?
August 20, 2012 at 6:30 am
Requires more validation, I'd imagine. But something like this: -
SELECT
CAST(SUBSTRING(a.yourDate, 5, CHARINDEX('UTC',a.yourDate,1)-6) + SUBSTRING(a.yourDate,CHARINDEX('UTC',a.yourDate,1)+8,8000) AS DATETIME)
FROM (VALUES ('Thu Jun 14 15:07:06 UTC+0530 2012')) a(yourDate)
August 20, 2012 at 7:04 am
Hi Cadavre,
Yes it works, Thanks for reply...:-)
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply