Format DateTime in the form: "W E D N E S D A Y 9/11"

I am using .NET/C#. I have DateTime values I'm pulling from a DB. For a given DateTime value, I want the day formatted with a space between each letter of the day. Then I want two spaces, then I want a numeric month and day divided by a slash. Examples:

"W E D N E S D A Y   9/11"
"F R I D A Y   9/13"

The spacing on the lettering should ideally be done with StringBuilder or whatever so this doesn't suffer massive perf issues.

I'm sure I could hack this out myself but one of you geniuses know this straight off the top of your head, hmm?

Thanks much for any help you can offer.
LVL 6
kennethfineAsked:
Who is Participating?

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

x
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.

jandromedaCommented:
Well this is what I can come up with.
DateTime time = DateTime.Today;
			string monthAndDate = time.ToString("MM/dd");
			string day = time.DayOfWeek.ToString();
			
			char[] arr = day.ToCharArray();
			day = string.Empty;		
			
			foreach (char c in arr)
			{
				day = string.Concat(day, c.ToString(), " ");
			}
			
			Console.WriteLine(string.Concat(day, " ", monthAndDate));

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
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
C#

From novice to tech pro — start learning today.