Solved

formatting date

Posted on 2004-10-13
3
223 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
[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
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

732 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