Yea, I saw that. I had a bit of a problem with "during this week" however,
as there is no concept of a "week" in any of the structures (apart from days
of the week of course).
Still can't work out how to formulate that (intelligence bypass)....
"Sven Groot" <sv*******@gmx.net> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
CJ Taylor wrote: "Robin Tucker" <id*************************@reallyidont.com> wrote in
message news:c7*******************@news.demon.co.uk... I need to test "relative dates" in my program, such as "last six
months" or "last 3 months" or "in the last week" etc. How can I do
this with a DateTime structure?
Use the DateTime.AddMonths function
i.e.
dim nDate as DateTime
Dim cDate as datetime = Now()
nDate = cDate.AddMonths(-6) ' the - is for 6 months ago
In addition to that, have a look at the TimeSpan structure, and the
DateTime.Add method that takes a TimeSpan as a parameter.
--
Sven Groot
http://unforgiven.bloghorn.com