Declare @DateTimeValue nvarchar(100)= '03/01/2017 13:15'
--Date Value
SELECT CONVERT(CHAR(10),CONVERT(DATETIME,LEFT(@DateTimeValue,10),105),101);
--Date Time Value
Select Cast(CONVERT(VARCHAR(24), CONVERT(DATETIME, max(@DateTimeValue), 103), 101)+' '+ CONVERT(VARCHAR(5), CONVERT(DATETIME, max(@DateTimeValue), 103), 108) as datetime)
--Date Value
SELECT CONVERT(CHAR(10),CONVERT(DATETIME,LEFT(@DateTimeValue,10),105),101);
--Date Time Value
Select Cast(CONVERT(VARCHAR(24), CONVERT(DATETIME, max(@DateTimeValue), 103), 101)+' '+ CONVERT(VARCHAR(5), CONVERT(DATETIME, max(@DateTimeValue), 103), 108) as datetime)
No comments:
Post a Comment