str_to_date function in sql server?

Alex Gordon picture Alex Gordon · Aug 19, 2010 · Viewed 15.8k times · Source

MySQL has a function called STR_TO_DATE, that converts a string to date.

Question:

Is there a similar function in SQL Server?

Answer

Aaron D picture Aaron D · Aug 19, 2010

If you need to parse a particular format, use CONVERT(datetime, @mystring, @format). Use this as a reference: http://www.sqlusa.com/bestpractices/datetimeconversion/