Here's what I use to get a HH:MM
string:
CONVERT(varchar(5), time_requested, 108)
I'm thinking there may be a more elegant way, even maybe more efficient (see similar question on How to remove the time portion of a datetime value (SQL Server)?).
Requirements:
- the final result has to be easily convertible to a string (in order to be able to concatenate some field
time_created
with a field such asdate_created
). - the following 2 cases must be covered:
HH:MM
andHH:MM:SS
.