title: Displaying hours and minutes from a SQL Server time column in an ASP.Net DetailsView
body: <p>In an ASP.Net DetailsView is a templete field called LateTimeArrivedAtSchool. The data for this field is from a SQL Server Time column. The data in the database in stored as hours, minutes and seconds.</p>
  
  <p>We would like to display it as only hours and minutes.</p>
  
  <p>Here is the markup for the template field:</p>
  
  <pre><code>&lt;asp:TemplateField HeaderText="Late Time Arrived At School:" SortExpression="LateTimeArrivedAtSchool"&gt;
      &lt;EditItemTemplate&gt;
          &lt;asp:TextBox ID="TextBoxLateTimeArrivedAtSchool" runat="server" 
              Text='&lt;%# Bind("LateTimeArrivedAtSchool") %&gt;'&gt;&lt;/asp:TextBox&gt;
      &lt;/EditItemTemplate&gt;
  
      &lt;InsertItemTemplate&gt;
          &lt;asp:TextBox ID="TextBoxLateTimeArrivedAtSchool" runat="server" 
              Text='&lt;%# Bind("LateTimeArrivedAtSchool") %&gt;'&gt;&lt;/asp:TextBox&gt;
      &lt;/InsertItemTemplate&gt;
  
      &lt;ItemTemplate&gt;
          &lt;asp:Label ID="LabelLateTimeArrivedAtSchool" runat="server" 
              Text='&lt;%# Bind("LateTimeArrivedAtSchool", "{0:hh:mm}") %&gt;'&gt;&lt;/asp:Label&gt;
      &lt;/ItemTemplate&gt;
  
      &lt;ItemStyle ForeColor="Blue" /&gt;
  &lt;/asp:TemplateField&gt;
  </code></pre>
  
  <p>using "{0:hh:mm}" produces an error that states the "Input string was not in a correct format."</p>
  
  <p>Can you tell me what we need to use in the Bind statement?</p>
  
  <p><strong>* UPDATE *</strong>
  I changed the SQL Server data type of the column from a Time column to a DateTime column and was able to display the time only portion of the data.</p>