Convert Time DataType into AM PM Format:

后端 未结 12 689
悲哀的现实
悲哀的现实 2020-12-23 16:02

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 follo

12条回答
  •  长情又很酷
    2020-12-23 16:27

    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
    

提交回复
热议问题