Solved

formatting date

Posted on 2004-10-13
3
187 Views
Last Modified: 2010-04-15
Hi Experts,

By default calendar returns : Monday, January 03, 2005
I would see it in form         : 01/03/2005

What ready-to-use method is in .NET to format it ?

Or may be yours :)

Thank you.
0
Comment
Question by:fpoyavo
3 Comments
 
LVL 15

Expert Comment

by:Timbo87
ID: 12303334
Assuming it returns a DateTime object, use this:

dateTime.ToShortDateString();

Replace dateTime with your DateTime object.
0
 
LVL 5

Expert Comment

by:tomasX2
ID: 12304185
0
 
LVL 3

Accepted Solution

by:
yellowjetski earned 500 total points
ID: 12304951
Here's how to use it

DateTime.Now.ToString("yyyyMMdd"") for 20041013

or

DateTime.Now.ToString("yyyy/MM/dd") for 2004/10/13

or

DateTime.Now.ToString("HHmmss") for 221232

or

DateTime.Now.ToString("HH:mm:ss") for 22:12:32

Here's a better link, I think. The Format Pattern in this link really helps

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemglobalizationdatetimeformatinfoclasstopic.asp

0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Suggested Solutions

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
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.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

758 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

19 Experts available now in Live!

Get 1:1 Help Now