<asp:Label ID="timeLabel" runat="server" Text='<%# Eval("time") %>' />
In this statement, "time" is a time datatype in my database. It displays as 16:00:00. I am trying to get this to display as 4:00 PM. I think this is pretty straight forward if I were working with a datetime datatype, but how can I convert this to datetime (to use the {HH.mm tt} formatting) or otherwise display with as AM/PM time.
I solved this one with SQL instead of C# here. I did try to add the TimeSpan to a DateTime within the Eval() argument, but I kept getting a FormatException. Also, the expression was getting kind of ridiculous.
I tried this
and this
It was considerably easier to modify the query to use
I am happy with this result. Though, I would be curious to know if I was on the right track with the C# expressions. Thanks so much for the input.