title: how to detect if the current time is between 15.31 - 15.45
body: <p>in dot net frame work 2</p>
  
  <p>how to better this and easy to used i have many times</p>
  
  <pre><code>using System;
  using System.Data;
  using System.Configuration;
  using System.Web;
  using System.Web.Security;
  using System.Web.UI;
  using System.Web.UI.WebControls;
  using System.Web.UI.WebControls.WebParts;
  using System.Web.UI.HtmlControls;
  
  public partial class _Default : System.Web.UI.Page 
  {
      protected void Page_Load(object sender, EventArgs e)
      {
          string timenow = DateTime.Now.ToString("T");
          Label1.Text = DateTime.Now.ToString("T");
          Label3.Text = DateTime.Now.ToString("D");
          Label2.Text = getTimeZone(timenow);
      }
  
      //hh:mm:ss
      protected string getTimeZone(string time)
      {
          string[] e = time.Split(':');
          int h = Convert.ToInt16(e[0]);
          int m = Convert.ToInt16(e[1]);
          int s = Convert.ToInt16(e[2]);
  
          if ((h == 15) &amp;&amp; (m &gt;= 1) &amp;&amp; (m &lt;= 30) &amp;&amp; (s &lt;= 59))
          {
              return "15.01 - 15.30";
          }
          if ((h == 15) &amp;&amp; (m &gt;= 31) &amp;&amp; (m &lt;= 45) &amp;&amp; (s &lt;= 59))
          {
              return "15.31 - 15.45";
          }
          if ((h == 15) &amp;&amp; (m &gt;= 46) &amp;&amp; (m == 0) &amp;&amp; (s &lt;= 59))
          {
              return "15.31 - 15.45";
          }
  
          return time;
      }
  }
  </code></pre>