jai jai - 3 months ago 21
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

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