title: How to Compare two time values (from Datetime) without Date in C#
body: <p>I have put a timer on my ASPX page, Where on tick it updates the "currenttime" on a asp:label called Label1, however when the page loads I store a DateTime value called "endtime", now what i want to do is when "currenttime" equals "endtime" fire Response.Redirect(...), my code is like below,</p>
  
  <p>ASPX</p>
  
  <pre><code> &lt;asp:ScriptManager ID="ScriptManager1" runat="server"&gt;
   &lt;/asp:ScriptManager&gt;
   &lt;asp:Timer ID="Timer1" runat="server" ontick="Timer1_Tick" Interval="1000"&gt;
   &lt;/asp:Timer&gt;
   &lt;asp:UpdatePanel ID="UpdatePanel1" runat="server"&gt;
         &lt;ContentTemplate&gt;
             &lt;asp:Label CssClass="captions2" ID="Label1" runat="server" Text="Exam Timer"&gt;&lt;/asp:Label&gt;
         &lt;/ContentTemplate&gt;
             &lt;Triggers&gt;
  
                 &lt;asp:AsyncPostBackTrigger ControlID="Timer1" EventName="Tick" /&gt;
  
             &lt;/Triggers&gt;
   &lt;/asp:UpdatePanel&gt;
  </code></pre>
  
  <p>Code Behind</p>
  
  <pre><code>protected void Timer1_Tick(object sender, EventArgs e)
      {
          if(...comparison goes here....){
  
          Response.Redirect("Nextpage.aspx")
          }else{
          Label1.Text = DateTime.Now.ToLongTimeString();
          }
      }
  </code></pre>
  
  <p>Please suggest me a solution</p>