Solved

formatting date

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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
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
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

809 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