SQL Server 2005 DateTime (hh: mm return only)

I am working on a stored procedure that returns a column of type DateTimedatatype.

But I want to return only hh:mmwithout seconds. I use this, but it returns seconds.

 CONVERT(VARCHAR(8), tbltime.Time, 108) AS [Time]

Any ideas for removing seconds?

+5
source share
2 answers

Just change it to convert to VARCHAR (5) instead :)

CONVERT(VARCHAR(5),tbltime.Time,108) AS [Time]
+22
source

try the following:

select left(CONVERT(VARCHAR(8),getdate(),108),5)
+1
source

All Articles