G
Gil
I run a webserver on Win2k Server and program in vb.net.
I am trying to perform a calculation that results in two
weeks of data given any selected date that starts with
the Sunday of the selected date. In order to accomplish
this I need to perform some date arithmetic.
For instance, if a user enters 11/6/2003 (Thu), then I
want to generate data from 11/2/2003 to 11/15/2003. If I
choose 11/3/2003 (Mon), this too would generate 11/2/2003
to 11/15/2003. But if I choose 11/10/2003, then I would
generate 11/9/2003 to 11/22/2003.
To do this my plan was to convert a Date to Int, perform
arithmetic, then convert back to Date. What I envisioned
was something like this:
If Weekday(SelectedDate) > 1
Then StartDate = CDate(CInt(SelectedDate) - Weekday
(SelectedDate) + 1)
End If
EndDate = CDate(CInt(StartDate) + 13)
This does not seem to work. I have even tried to use
CType to coerce, unsucessfully.
Please help.
TIA,
Gil
I am trying to perform a calculation that results in two
weeks of data given any selected date that starts with
the Sunday of the selected date. In order to accomplish
this I need to perform some date arithmetic.
For instance, if a user enters 11/6/2003 (Thu), then I
want to generate data from 11/2/2003 to 11/15/2003. If I
choose 11/3/2003 (Mon), this too would generate 11/2/2003
to 11/15/2003. But if I choose 11/10/2003, then I would
generate 11/9/2003 to 11/22/2003.
To do this my plan was to convert a Date to Int, perform
arithmetic, then convert back to Date. What I envisioned
was something like this:
If Weekday(SelectedDate) > 1
Then StartDate = CDate(CInt(SelectedDate) - Weekday
(SelectedDate) + 1)
End If
EndDate = CDate(CInt(StartDate) + 13)
This does not seem to work. I have even tried to use
CType to coerce, unsucessfully.
Please help.
TIA,
Gil