Dotnet Tutorials ,Codings & Examples: Difference between two dates <h1 class='display-2'> Difference between two dates ~ Dotnet Tutorials ,Codings & Examples</h1>

Difference between two dates

This snippet calculates the difference between two dates.

DateTime d1 = new DateTime( 2000, 7, 13 );
DateTime d2 = new DateTime( 2003, 12, 5 );
TimeSpan s = d2 - d1;
int numberofdays = s.TotalDays

0 comments :

Post a Comment