Look at System.DateTime and System.TimeSpan.
http://msdn.microsoft.com/library/en...classtopic.asp http://msdn.microsoft.com/library/en...classtopic.asp
DateTime dtThen = new DateTime (2004, 1, 1);
DateTime dtNow = DateTime.Now;
TimeSpan ts = dtNow - dtThen;
DateTime also contains functions like AddHours & AddMinutes. I don't think
there is any direct equivalent to DateDiff, but you can certainly accomplish
the same thing in other ways using DateTime and TimeSpan.
- Jon
"Paul Aspinall" <pa**@aspy.co.uk> wrote in message
news:%_********************@fe3.news.blueyonder.co .uk...
Hi
I want to calculate the difference between 2 dates in C#.
I know there is a function in VB, called DateDiff, but I don't want to ref
the VB library, and want to try to do it natively in C#.
Is there a similar function available in the C# or standard .NET
libraries?
Thanks