Friday, 17 July 2015

Convert Time DataType into AM PM Format:

Use following syntax to convert a time to AM PM format.
Replace the field name with the value in following query.
select CONVERT(varchar(15),CAST('17:30:00.0000000' AS TIME),100)

SELECT REPLACE(CONVERT(varchar(15),StartTime,22),':00','') AS StartTime,
     REPLACE(CONVERT(NVARCHAR(15),EndTime,22),':00','') AS EndTime
FROM LMS_tbl_TimeSlotDetails AS dtl

No comments:

Post a Comment