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?

Thanks!
cdemott33Asked:
Who is Participating?
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"))
		Next

Open in new window

0

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
Dates-in-Week.xlsm
0
Tony PittCommented:
:-( It looks like I'm 30 minutes too slow!

/T
0
cdemott33Author Commented:
Thank you for your help,
0
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
ASP.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.