Grid View time format - hide seconds

Hi Experts,

This is one of those irritating things that I've never found a solution to. I'm using a grid view to display some sql data including a 'time (7)' field, by default this displays as hh:mm:ss. I'd like to hide the :ss part.

I have tried a couple of methods but neither have any impact:

Text='<%# Bind("otEnd","{0:HH:mm}") %>'


In both the above examples the time continues to display in the format hh:mm:ss (grrrr) anyone...?
Who is Participating?
Lokesh B RDeveloperCommented:

Convert the time(7) column to datetime in your SELECT query and use the format string in gridview.

SELECT CAST(otEnd AS datetime)  AS otEnd



Text='<%# Bind("otEnd","{0:HH:mm}") %>'
forstersAuthor Commented:
Thank you
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.