This post will probably only matter to those of us who have VB roots, which I get no end of heckling from my co-workers about. But as I was working today, one of the things I had to do was calculate the span between two dates in months. Piece of cake, I thought to myself. All I have to do is use the DateDiff and specify months...except where is DateDiff in C#??? It is AWOL!
So I tried to see what else I could come up with. I did uncover this thing called System.Timespan. Apparently, Timespan will give you the difference between two DateTimes in something called 'ticks.' You can then take the ticks, and convert them to days, hours, minutes, seconds, and milliseconds. The drawback is that if you want the difference in years or months, you have to do some hoaky manual calculation that may or may not jibe with what the span really should come out to. In my research, this was the best example of how to duplicate the DateDiff in C#.