Sql Server string to date conversion

后端 未结 14 735
执笔经年
执笔经年 2020-11-22 09:18

I want to convert a string like this:

\'10/15/2008 10:06:32 PM\'

into the equivalent DATETIME value in Sql Server.

In Oracle, I wou

14条回答
  •  一生所求
    2020-11-22 09:56

    Use this:

    SELECT convert(datetime, '2018-10-25 20:44:11.500', 121) -- yyyy-mm-dd hh:mm:ss.mmm
    

    And refer to the table in the official documentation for the conversion codes.

提交回复
热议问题