Blair Osbay
Blair Osbay

Reputation: 227

Date string to datetime SQL Server for a dash-delimited format

How do you convert a string like 2015-10-08 19:56:30.0 to a datetime in SQL Server without having to change languages?

Upvotes: 3

Views: 1161

Answers (1)

Ruhaan
Ruhaan

Reputation: 174

I think this may help you, I have tried this.

Declare @Time as nvarchar(25)
Set @Time = '2015-10-08 19:56:30.0'
Select Cast(@Time As DateTime);

Upvotes: 1

Related Questions