Click here to Skip to main content
15,887,253 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
protected void Page_Load(object sender, EventArgs e)
    {




       double startCounter = Convert.ToDouble(DateTime.Now.TimeOfDay.TotalSeconds);
        if (!IsPostBack)
        {
        }
    }
    double endCounter = Convert.ToDouble(DateTime.Now.TimeOfDay.TotalSeconds);
    double totalSeconds = Convert.ToDouble( endCounter -  startCounter);
        Response.Write(totalSeconds);

}


please help me
Posted

1 solution

These lines
C#
double endCounter = Convert.ToDouble(DateTime.Now.TimeOfDay.TotalSeconds);
double totalSeconds = Convert.ToDouble( endCounter -  startCounter);
Response.Write(totalSeconds);

Are not inside the scope of the method, move them in;
C#
protected void Page_Load(object sender, EventArgs e)
{
  double startCounter = Convert.ToDouble(DateTime.Now.TimeOfDay.TotalSeconds);
  if (!IsPostBack)
  {
  }
  double endCounter = Convert.ToDouble(DateTime.Now.TimeOfDay.TotalSeconds);
  double totalSeconds = Convert.ToDouble( endCounter -  startCounter);
  Response.Write(totalSeconds);
}


Hope this helps,
Fredrik
 
Share this answer
 
Comments
Phil J Pearson 8-Aug-13 11:17am    
I suggest you post another question about the timing. It's a separate topic.
Fredrik Bornander 8-Aug-13 10:46am    
You posted that as a comment to my answer, not to his comment, I'm not sure he'll get notified.

Or, if it was intended for me, I think I'll pass :)
Phil J Pearson 8-Aug-13 11:18am    
Thanks. I fixed it.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900