By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,183 Members | 1,190 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,183 IT Pros & Developers. It's quick & easy.

How to format date in MMDDYYY format?

P: n/a
I am trying to format the system date in the MMDDYYYY format and am having
troubles. Does anyone have a code sample for me? Thank you.
Nov 16 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
String dateString=DateTime.Now.ToString("MM/dd/yyyy");
Console.WriteLine(dateString);

note that the 'MM' portion is in CAPS.

David

"Florida . NET Coder" <No****@FloridaDevelopment.com> wrote in message
news:ee**************@TK2MSFTNGP14.phx.gbl...
I am trying to format the system date in the MMDDYYYY format and am having
troubles. Does anyone have a code sample for me? Thank you.

Nov 16 '05 #2

P: n/a
"Florida . NET Coder" <No****@FloridaDevelopment.com> wrote in message
news:ee**************@TK2MSFTNGP14.phx.gbl...
I am trying to format the system date in the MMDDYYYY format and am having
troubles. Does anyone have a code sample for me? Thank you.


DateTime dt = DateTime.Now;

Console.WriteLine("{0:MMddyyyy}", dt);
--
Truth,
James Curran
[erstwhile VC++ MVP]
Home: www.noveltheory.com Work: www.njtheater.com
Blog: www.honestillusion.com Day Job: www.partsearch.com
Nov 16 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.