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)
Output: 5:30PM
Better option is available with Sql 2012. First parameter should be of datetime data type.
DECLARE @d DATETIME = '10/01/2011 13:14';
SELECT FORMAT(@d,'hh:mm tt')
Output : 01:14 PM
In SQL 2012 you can use the Format() function.
https://technet.microsoft.com/en-us/library/hh213505%28v=sql.110%29.aspx
Skip casting if the column type is (datetime).
Example:
SELECT FORMAT(StartTime,'hh:mm tt') AS StartTime
FROM TableA