title: Format date in GridView
body: <p>Please see the database DDL below:</p>
  
  <pre><code>create table datetest (datetime1 datetime)
  insert into datetest values(getdate())
  </code></pre>
  
  <p>Please see the presentation code below:</p>
  
  <pre><code>&lt;asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
      DataSourceID="SqlDataSource1"&gt;
  
       &lt;Columns&gt;
              &lt;asp:TemplateField HeaderText="Status"&gt;
                  &lt;ItemTemplate&gt;
                      &lt;asp:Label ID="Label1" runat="server" Text='&lt;%# bind("datetime1") %&gt;'&gt;&lt;/asp:Label&gt;
                  &lt;/ItemTemplate&gt;
              &lt;/asp:TemplateField&gt;
          &lt;/Columns&gt;
  
      &lt;/asp:GridView&gt;
  </code></pre>
  
  <p>The output on the page is: 11/04/2013 19:51:40, but the database value is: 2013-04-11 19:51:40.017 (notice the milliseconds are chopped off the first value).</p>
  
  <p>I have looked into this and have found a number of posts on here, which suggest using EVAL and String.Format, but I have been unsuccessful.  How can I display milliseconds on the webpage?</p>
  
  <p>I have tried the following code:</p>
  
  <pre><code>&lt;asp:Label ID="Label1" runat="server" Text='&lt;%
  Eval("datetime1").ToString("dd/MM/yyyy hh:mm:ss.fff") %&gt;'&gt;&lt;/asp:Label&gt;
  </code></pre>
  
  <p>However, I am prompted with an exception: "Conversion from string "dd/MM/yyyy" to type 'Integer' is not valid."</p>