How do I write this date format string?

I need to display the following date  8/1/2010  as  August 1  only

When I use the long date format {0:D}  I get day of the week, month, day, and year

BTW the date is pulled from a db

Thanks
bmanmike39Asked:
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.

Fernando SotoRetiredCommented:
Try it like this.

DateTime dt = new DateTime(2010, 8, 1)
string printedDate = dt.ToString("MMM d");
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
Reza RadConsultant, TrainerCommented:
Response.Write((new DateTime(2010,1,8).ToString("MON dd"));
0
Reza RadConsultant, TrainerCommented:
sorry,try this one:
Response.Write((new DateTime(2010,1,8).ToString("MMM dd"));

0
Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

vb_studentCommented:
sadly there are no Month, Day formats built into VB but there is Month, Day, YYYY you can change the way it will display the date by doing somthing like this.

dim pulled_date as date = data_field_value

dim display_date as string
        Select Case pulled_date.Month
            Case 1
                display_date = "january"
            Case 2
                display_date = "febuary"
ect.
ect.
        End Select

display_date += pulled_date.day

hope this helps.
0
Reza RadConsultant, TrainerCommented:
this will show month with only 3 first characters :
Response.Write((new DateTime(2010,1,8).ToString("MMM dd"));

but this will show full months names:
Response.Write((new DateTime(2010,1,8).ToString("MMMM dd"));
0
bmanmike39Author Commented:
Thanks!
0
Fernando SotoRetiredCommented:
Not a problem, always glad to 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
.NET Programming

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.