Solved

Date Format in C#

Posted on 2012-04-13
6
402 Views
Last Modified: 2012-04-17
Hi There,

How to get this type of date format?

Vlaue from DB: 2012-04-13 00:00:00.000 to April 13, 2012 (Friday).

Thanks.
0
Comment
Question by:theartha
6 Comments
 
LVL 39

Accepted Solution

by:
Kyle Abrahams earned 500 total points
Comment Utility
DateTime dt = <value from db>

dt.ToString("MMMM dd, yyyy") + "(" + dt.ToString("dddd") + ")";


See this for more Info:
http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx
0
 
LVL 13

Expert Comment

by:Ashok
Comment Utility
Try

DateTime dt = new DateTime(2008, 3, 9, 16, 5, 7, 123);

String.Format("{0:MMMM dd, yyyy (dddd)}", dt);

HTH
Ashok
0
 

Expert Comment

by:nerdeasy
Comment Utility
Here is some sample code:

DateTime dateValue = DateTime.Parse("2012-04-13 00:00:00.000");
Console.WriteLine(dateValue.ToString("MMMM d, yyyy (dddd)"))

Open in new window


That should help
0
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 
LVL 13

Expert Comment

by:Ashok
Comment Utility
DateTime dt = new DateTime(2008, 3, 9, 16, 5, 7, 123);
      string s1 = dt.ToString("MMMM d, yyyy (dddd)");
      string s2 = dt.ToString("MMMM dd, yyyy (dddd)");

s1 will give 1 digit for a day.
s2 will give you 2 digits for a day.

HTH
Ashok
0
 
LVL 12

Expert Comment

by:Anuradha Goli
Comment Utility
You can try
DateTime dt = DateTime.Parse("2012-04-13 00:00:00.000");
Console.WriteLine(dt.ToString("MMMM d, yyyy (dddd)"))
0
 

Expert Comment

by:seenupegada
Comment Utility
Try this,

in <itemtemplate>

<%#Eval("Doj", "{0:MMMM d, yyyy(dddd)}")%>
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

728 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now