January 15, 2010 at 9:03 am
How can I conver the following string to datatime data.
January 8, 2010, 12:57:45 pm
Thanks.
January 15, 2010 at 9:10 am
Here is a link that covers several datetime conversions.
http://www.sqlusa.com/bestpractices2005/sqlserverstringtodate/
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
January 15, 2010 at 9:32 am
In your case, you need to remove the commas from the string. I'd also recommend using the date/time style, especially if you know the the dates are all formated the same as it tells the convert function the format of the date/time in the string.
select convert(datetime, replace('January 8, 2010, 12:57:45 pm',',',''), 109),convert(datetime, replace('January 8, 2010, 12:57:45 pm',',',''))
January 15, 2010 at 9:49 am
Hi lynn,
Thanks for your help.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply