Date Syntax for .NET
Today I discovered that .NET has some interesting new properties and methods that can be used for deriving dates, including comparisons. My requirement was to determine the number of days between two dates with a difference between a given number of months. Here's what I came up with:
iMonthCount = -6
Date.Today.Subtract(Date.Today.AddMonths(iMonthCount)).Days
This expression shows the number of days in the past six months.
Now I don't need to use the DateAdd() or DateDiff() functions any more.
1 Comments:
Cool!
Post a Comment
<< Home