In
this article I am going to explain how to calculate total number of days
between two dates in asp.net.
In
the previous article I have explained how to show and hide the div on buttonclick using Jquery, how to implement pagination in using Angularjs and dirpagination Js and how to search andhighlight the matched text using AngularJs.
Implementation:
protected void Page_Load(object sender, EventArgs e)
{
DateTime date1 = new DateTime(2016,08,01);
DateTime date2 = new DateTime(2016, 09, 13);
string totaldays = (date2 -
date1).TotalDays.ToString();
Response.Write("Total days
are :" + totaldays);
}
VB.Net Code:
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
Dim date1 As New DateTime(2016, 8, 1)
Dim date2 As New DateTime(2016, 9, 13)
Dim [totaldays] As String = (date2 -
date1).TotalDays.ToString()
Response.Write(Convert.ToString("Total days are
:") & [totaldays])
End Sub
0 Comments