Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想将日期格式从转换May 4 2013 2:28AM为2013-05-04 02:28:34.000.
May 4 2013 2:28AM
2013-05-04 02:28:34.000
有人帮我吗?
您可以使用CAST或CONVERT函数来转换日期格式。
CAST
CONVERT
使用 CAST:
SELECT CAST('May 4 2013 2:28AM' AS DATETIME)
输出:
2013-05-04 02:28:00.000
使用转换:
SELECT CONVERT(DATETIME, 'May 4 2013 2:28AM')