I have one Table which has two fields such as “StartTime” and “EndTime”. The DataType of the Two columns are Time.
So the Values of the Table looks like as follows:
TableA:
StartTime EndTime
------------------ ----------------
17:30:00.0000000 17:57:00.0000000
But I need the result as
StartTime EndTime
------------------ ----------------
05:30 PM 05:57 PM
When I select the table. How to get time in AM PM Format?
Use following syntax to convert a time to AM PM format.
Replace the field name with the value in following query.
Output: 5:30PM
Better option is available with Sql 2012. First parameter should be of datetime data type.
Output : 01:14 PM