I'm working on a program for a local group of guys I play basketball with. Basically something to help us know who's committing to playing then next two dates, instead of sending emails around. Anyway, I'm having trouble getting my program to automatically determine the Friday and Monday correctly.
For example. If it's Tuesday, Wednesday, or Thursday, I want to know the Date of the upcoming Friday and Monday. If today is TOMORROW, something like:
Friday, April 1st 2011 and Monday, April 4th 2011
If it's a Friday I want to know the date of that Friday and following Monday. So if's Friday April 1st I want to know:
Friday, April 1st 2011 and Monday, April 4th 2011
If it's Saturday, Sunday, or Monday, I want to know the LAST Friday and Monday. So if it's Monday April 4th, I want to know:
Friday, April 1st 2011 and Monday, April 4th 2011
I've been messing around with Calendar and Date, and seemed to get close with the Date class, but my results seemed kind of screwy. One day it would seem to work, the next I would be a day off.
Can anyone help with any sample code?
Thanks,
James
For example. If it's Tuesday, Wednesday, or Thursday, I want to know the Date of the upcoming Friday and Monday. If today is TOMORROW, something like:
Friday, April 1st 2011 and Monday, April 4th 2011
If it's a Friday I want to know the date of that Friday and following Monday. So if's Friday April 1st I want to know:
Friday, April 1st 2011 and Monday, April 4th 2011
If it's Saturday, Sunday, or Monday, I want to know the LAST Friday and Monday. So if it's Monday April 4th, I want to know:
Friday, April 1st 2011 and Monday, April 4th 2011
I've been messing around with Calendar and Date, and seemed to get close with the Date class, but my results seemed kind of screwy. One day it would seem to work, the next I would be a day off.
Can anyone help with any sample code?
Thanks,
James