?
Solved

How do I write this date format string?

Posted on 2010-01-09
7
Medium Priority
?
208 Views
Last Modified: 2013-12-17
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
0
Comment
Question by:bmanmike39
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 63

Accepted Solution

by:
Fernando Soto earned 1000 total points
ID: 26274655
Try it like this.

DateTime dt = new DateTime(2010, 8, 1)
string printedDate = dt.ToString("MMM d");
0
 
LVL 30

Expert Comment

by:Reza Rad
ID: 26274662
Response.Write((new DateTime(2010,1,8).ToString("MON dd"));
0
 
LVL 30

Expert Comment

by:Reza Rad
ID: 26274666
sorry,try this one:
Response.Write((new DateTime(2010,1,8).ToString("MMM dd"));

0
Interactive Way of Training for the AWS CSA Exam

An interactive way of learning that will help you visualize core concepts so that you can be more effective when taking your AWS certification exam.  Built for students by a student to help them understand the concepts that they are being taught.

 
LVL 5

Expert Comment

by:vb_student
ID: 26274733
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
 
LVL 30

Assisted Solution

by:Reza Rad
Reza Rad earned 1000 total points
ID: 26274780
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
 

Author Closing Comment

by:bmanmike39
ID: 31675034
Thanks!
0
 
LVL 63

Expert Comment

by:Fernando Soto
ID: 26274889
Not a problem, always glad to help.  ;=)
0

Featured Post

Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question