jai jai - 1 year ago 113
SQL Question

Converting datetime variable format

I need help in converting a DateTime variable with format mmm dd yyyy
to a Datetime variable with format yyyy-mm-dd

Answer Source

I'm assuming your datetime variable is a VARCHAR - this can be directly cast via CONVERT:

Declare @YourVariable Varchar (15) = 'JAN 01 1996'

Select Convert(Date, @YourVariable)

1996-01-01