Display Days of week, Monday - Sunday

Hi All -

I need to be able to take today's day (or any date for that matter) and pass it to a function that will write out all the days of the week, from Monday through Sunday.

For example, If I pass in 04/23/2015 (which is a Thursday) I want the display the following

Monday, 4/20
Tuesday, 4/21
Wednesday, 4/22
Thursday, 4/23
Friday, 4/24
Saturday, 4/25
Sunday, 4/26

Could someone write out the code (VB if possible, otherwise I'll covert it) on how I can do this?

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jacques Bourgeois (James Burger)PresidentCommented:
		Dim myDate As Date = Date.Today
		Dim mondayDate As Date = myDate.AddDays(DayOfWeek.Monday - myDate.DayOfWeek)
		Dim dateToDisplay As Date

		For x As Integer = 0 To 6
			dateToDisplay = mondayDate.AddDays(x)
			Debug.WriteLine(dateToDisplay.DayOfWeek.ToString & ", " & dateToDisplay.ToString("M/dd"))

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Tony PittCommented:
Here's an example in VBA in Excel.   It should give you the idea of how to achieve what you want.

Tony PittCommented:
:-( It looks like I'm 30 minutes too slow!

cdemott33Author Commented:
Thank you for your help,
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.