How to use DateDiff Function in C#.
As earlier in ASP and VB6 we have too may conversion and date time functions.
After working for so many years, we all had become habitual of working with the same.
We have almost all the functions available in c#. But, sometimes lost control on some functions.
Like for datediff WE have to write so much code in C#. At this moment we just remember functions of VB.
Now, say thanks to Microsoft… What we can use is:-
Add a reference of Microsoft.VisualBasic and access the DateDiff function like following ex.
long nYears = Microsoft.VisualBasic.DateAndTime.DateDiff(Microsoft.VisualBasic.DateInterval.Year,
By using the reference of visual basic you can use any function of Visual Basic or vice-versa.