How to parse string into date?

Nazar Tereshkovych picture Nazar Tereshkovych · Apr 24, 2012 · Viewed 315.2k times · Source

How can I convert a String to a Date in T-SQL?

My test case is the string: '24.04.2012'

Answer

Chris Roberts picture Chris Roberts · Apr 24, 2012
CONVERT(datetime, '24.04.2012', 104)

Should do the trick. See here for more info: CAST and CONVERT (Transact-SQL)