narasiman man

narasiman man

  • NA
  • 0
  • 112.5k

Doubt

Feb 24 2012 11:06 AM
public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        string format = "h.m tt";
        DateTime startTime = DateTime.ParseExact("0.00 AM", format, null);
        DateTime endTime = DateTime.ParseExact("0.00 pm", format, null);
        double totalTime = (endTime - startTime).TotalHours;
        Response.Write(String.Format("Total time worked is {0} hours", totalTime));


    }
   
}


i try this code

star time 7.00AM
end time 1100 AM

Total time output show 12 hours

output is wrong i typed the above code what is wrong in the above code please help and send the correct code with example. help me.


Answers (1)