Sql Server string to date conversion

Posted by JosephStyons on Stack Overflow See other posts from Stack Overflow or by JosephStyons
Published on 2008-10-16T02:08:51Z Indexed on 2010/05/03 8:38 UTC
Read the original article Hit count: 297

I want to convert a string like this:

'10/15/2008 10:06:32 PM'

into the equivalent DATETIME value in Sql Server.

In Oracle, I would say this:

TO_DATE('10/15/2008 10:06:32 PM','MM/DD/YYYY HH:MI:SS AM')

This question implies that I must parse the string into one of the standard formats, and then convert using one of those codes. That seems ludicrous for such a mundane operation. Is there an easier way?

© Stack Overflow or respective owner

Related posts about string-to-date

Related posts about string