title: How can I compare date of two rows
body: <p>I have Gridview and Datasource like this:</p>
  
  <pre><code>&lt;asp:SqlDataSource ID="SqlDataSource10" runat="server" 
          ConnectionString="&lt;%$ ConnectionStrings:ConnectionString %&gt;" 
          ProviderName="&lt;%$ ConnectionStrings:ConnectionString.ProviderName %&gt;" 
          SelectCommand="SELECT * FROM [data.csv]"&gt;&lt;/asp:SqlDataSource&gt;
  
      &lt;asp:GridView ID="GridView3" runat="server" AutoGenerateColumns="False" 
          BackColor="White" BorderColor="#999999" BorderStyle="None" BorderWidth="1px" 
          CellPadding="3" DataSourceID="SqlDataSource10" GridLines="Vertical" 
          Width="695px" Height="130px" onrowdatabound="GridView3_RowDataBound"&gt;
          &lt;AlternatingRowStyle BackColor="#DCDCDC" /&gt;
          &lt;Columns&gt;
              &lt;asp:BoundField DataField="H" HeaderText="H" 
                  SortExpression="H" &gt;
              &lt;HeaderStyle Width="115px" /&gt;
              &lt;/asp:BoundField&gt;
              &lt;asp:BoundField DataField="V" HeaderText="V" 
                  SortExpression="V" &gt;
              &lt;HeaderStyle Width="100px" /&gt;
              &lt;/asp:BoundField&gt;
              &lt;asp:BoundField DataField="F" HeaderText="F" 
                  SortExpression="F" dataformatstring="{0:dd-MM-yyyy HH:mm}" &gt;
              &lt;HeaderStyle Width="180px" /&gt;
              &lt;/asp:BoundField&gt;
              &lt;asp:BoundField DataField="V" HeaderText="V" 
                  SortExpression="V" dataformatstring="{0:dd.MM.yyyy HH:mm}" &gt;
              &lt;HeaderStyle Width="180px" /&gt;
              &lt;/asp:BoundField&gt;
  </code></pre>
  
  <p>I use csv file for data. I have to change backcolor if date value is old(2 hours).</p>
  
  <p>I can do that for first date column like this:</p>
  
  <pre><code> DateTime dt;
    if (DateTime.TryParseExact(e.Row.Cells[1].Text, "dd.MM.YYYY HH:mm",
                           CultureInfo.InvariantCulture,
                           DateTimeStyles.None, out dt))
  {
     if (dt &lt;= DateTime.Now.AddHours(-2))
     {
         if (e.Row.Cells[0].Text.Contains("M"))
         {
             e.Row.Cells[1].BackColor = Color.LightCoral;
         }
     }
  </code></pre>
  
  <p>If first date column values older than 2 hours, backcolor changing.</p>
  
  <p>I need to do this for 2. date column. But compare to first date value. If second date value older than 2 hours according to the first date value, backcolor changing:</p>
  
  <p><img src="https://i.stack.imgur.com/9neoM.jpg" alt="enter image description here"></p>
  
  <p>How can I do that?</p>