如何将DD-MM-YYYY HH:MM:SS(24小时格式)转换为DD-MMM-YYYY HH:MM:SS(24小时格式)。如下:
Given input: 11-10-2017 11:23:30
Required output: 11-Oct-2017 11:23:30
答案 0 :(得分:0)
DECLARE @Datetime DATETIME = CONVERT(DATETIME, '11-10-2017 11:23:30', 105)
SELECT
[Full] = CONVERT(VARCHAR(30), @DateTime, 113),
Truncated = SUBSTRING(
CONVERT(VARCHAR(30), @DateTime, 113),
1,
20)
-- Full: 11 Oct 2017 11:23:30:000
-- Truncated: 11 Oct 2017 11:23:30