Monday, August 17, 2009

Calculate Date Time difference in asp.net c#

Calculate Date time difference in asp.net c#
 
TimeSpan tmspan = DateTime.Parse(DateTime.Now.ToString()).Subtract(DateTime.Parse(YourTime.Text));

Response.Write(tmspan.Hours);

Response.Write("<br>");

Response.Write(tmspan.Minutes);

Response.Write("<br>");

Response.Write(tmspan.TotalHours);

Response.Write("<br>");

Response.Write(tmspan.TotalMinutes);

No comments: