[thelist] ASP.NET - Date Logic Question
Casey Crookston
casey at thecrookstons.com
Thu Oct 7 09:06:51 CDT 2004
----- Original Message -----
From: "Casey Crookston"
> Need a little help with logic... what's the best way to display the date
of
> the most recent Monday? In other words, no matter what day of the week it
> is, I need to say "Download the newsletter for the week of October 4th,
> 2004" Until next week, when it will change to "Download the newsletter
for
> the week of October 11th, 2004"
>
> Is there a way to derive what day of the week it is as an integer? Monday
=
> 2, Tuesday=3, etc?
Update:
this_day = weekday(this_day)
returns a value of 1 to 7 depending on the day. Perfect! Almost. The
problem is, the value of this_day is now in date format, and I can't use +
or - to alter it. I tried using: this_day = CInt(this_day), but IIS spit
back :
System.InvalidCastException: Cast from type 'Date' to type 'Integer' is not
valid.
So the problem still remains... how do I dispay the date of the previous
Monday????
Thanks
More information about the thelist
mailing list