|
ou812 -> Find Previous Friday (4/3/2008 11:50:55)
|
I need to come up with a function to find the previous Friday's date when a date is entered. So, if a date is entered and it is Wednesday April 2nd, I need to be able to know the previous Friday was March 28th. Has anyone already written something like this, or have some thoughts? I'm not sure how to attack it just yet, but I'm thinking I can just subtract a day, looping backwards from the entered date, and then check the weekday of that date until I hit a Friday. But there has to be a better way. Hmm, and if the date is already Friday, I need to go back to the previous still. Any thoughts? Oh, and for this I'm using ASP, but any psuedo code or ideas would be great.
|
|
|
|