1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Windows How do I get a datetime format in C# that will look like this:

Discussion in 'Software' started by Captain Xarzu, 22 Sep 2011.

  1. Captain Xarzu

    Captain Xarzu What's a Dremel?

    Joined:
    22 Aug 2007
    Posts:
    15
    Likes Received:
    0
    How do I get a dattime format in C# that will look like this:

    2011-09-01 00:00:00:000
     
  2. BentAnat

    BentAnat Software Dev

    Joined:
    26 Jun 2008
    Posts:
    7,230
    Likes Received:
    219
    You COULD always use the .Year, .Month, .Day properties exposed by any DateTime.
    But there are string format providers out there that can do that for you as well. I'd sugges searching for those.
     
  3. Xlog

    Xlog Minimodder

    Joined:
    16 Dec 2006
    Posts:
    674
    Likes Received:
    68
    Code:
    Console.WriteLine("Date with milliseconds: {0:yyyy-MM-dd hh:mm:ss:fff}", DateTime.Now);
     
  4. Landy_Ed

    Landy_Ed Combat Novice

    Joined:
    6 May 2009
    Posts:
    1,428
    Likes Received:
    39

Share This Page