Reputation: 6778
How can i convert string for example 25.6.2014 to DATETIME datatype ? I tried
SELECT CONVERT(datetime, '25.6.2014')
SELECT CAST ('25.6.2012' AS datetime)
but it return error
The conversion of a varchar data type to a datetime data type resulted in an out-of-range value.
because it take argument like month.date.year
Thank for help
Upvotes: 0
Views: 1639
Reputation: 8839
you can use
SELECT CONVERT(datetime, '25.6.2014', 103)
for all date time conversion
http://www.sqlusa.com/bestpractices/datetimeconversion/
at above link all date time conversions are given
Upvotes: 0
Reputation: 44326
Try highlightning CONVERT in studio management and press shift F1
SELECT CONVERT(datetime, '25.6.2014', 103)
Upvotes: 2