formatting datetime

G

Guest

Hi all
I need to format a given datetime to the format
"mm/dd/yy hh:mm" - how do I do this?
DateTime.ToString() returns "mm/dd/yy hh:mm AM or PM" -
this is not the format I want. Thank you all in advance.
 
G

Guest

I guess I figured it out. By doing the foll.
dt.ToString("MM/dd/yy HH:mm"), I accomplished what I
needed.
Thanks a lot to everyone that replied.
 
C

Chad Myers

Hi all
I need to format a given datetime to the format
"mm/dd/yy hh:mm" - how do I do this?
DateTime.ToString() returns "mm/dd/yy hh:mm AM or PM" -
this is not the format I want. Thank you all in advance.

See the Formatting guidelines in the .NET Framework SDK docs.

..NET Framework SDK
- Programming with the .NET Framework
- Working with Base Types
- Formatting Types

ms-help://MS.NETFrameworkSDKv1.1/cpguidenf/html/cpconformattingtypes.htm

DateTime dt = new DateTime(2004, 3, 26, 0, 0, 0);

Console.WriteLine( dt.ToString("MM/dd/yy hh:mm") );

-c
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top