Show HH:mm 24H format in TemplateField using text property
-
23-08-2019 - |
Question
I'm trying to show a 24 hours format using this line:
Text='<%# Bind("Appointment", "{HH:mm}")
So how it'll be formated for showing for example 16:40 instead 4:40?
Solution
if you don't need to bind it, try:
Text='<%# string.Format("{0:HH:mm}", Eval("Appointment"))%>'
otherwise i suppose you can update the field value in the OnDataBound event.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow