Solved

SQL Convert Date

Posted on 2013-06-10
2
256 Views
Last Modified: 2013-06-12
Hi Guys

SQL Server 2008.

I need to convert 'Tue Jun 18 10:00:00 UTC+0100 2013' to '2013-06-18 10:00:00.000'.

Any ideas

Thanks,
Shezad
0
Comment
Question by:Shezad Ahmed
2 Comments
 
LVL 22

Expert Comment

by:plusone3055
ID: 39234463
0
 
LVL 25

Accepted Solution

by:
Lee Savidge earned 500 total points
ID: 39234468
Messy but it works:

select convert(nvarchar(23), cast(substring(replace('Tue Jun 18 10:00:00 UTC+0100 2013', 'UTC+0100 ', ''), 4, 1000) as datetime), 121)
0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
I have a large data set and a SSIS package. How can I load this file in multi threading?
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question