On Oct 18, 8:41*pm, "Peter Duniho" <NpOeStPe...@nnowslpianmk.com>
wrote:
> On Sat, 18 Oct 2008 12:32:51 -0700, shapper <mdmo...@gmail.com> wrote:
> > Arne code does not solve it ... It is used TotalMonths which does not
> > exist in C#. I could use TotalDays / 30 but that wouldn't be accurate.
> > That is the reason of my code ...
>
> Ah, right. *Sorry. *I just assumed that Arne wouldn't post code that *
> doesn't compile; that's more like me to do that, not him. *
>
> And yes, you're right...no TotalMonths for TimeSpan. *Which actually makes *
> sense, now that I think about it, since TimeSpan is not relative to any *
> specific date, and the total months for a TimeSpan would depend on the *
> specific date.
>
> My recollection is that the System.Globalization.Calendar class has some *
> date/time math functionality in it. *Whether it addresses this specific*
> question, I'm not sure, and I don't have time to check at the moment. *But *
> you might look at that in the meantime.
>
> You could certainly write the basics yourself, especially if you have only *
> a very narrow need (for example, you always know you only need months). *
> But if there's something in the framework that accomplishes it, that's *
> probably better. *For that matter, if the Calendar class doesn't work, *
> maybe referencing the VB assembly is the best solution after all (but it *
> still won't deal with the nulls
...I really did read your original *
> question as being focused on the question of dealing with null values; I *
> didn't realize you were asking about the month calculation too).
>
> Pete
Thanks Pete. I will take a look into System.Globalization.Calendar.