How to format date in MMDDYYY format?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Florida . NET Coder

    How to format date in MMDDYYY format?

    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.


  • Sal Bompensaro

    #2
    Re: How to format date in MMDDYYY format?

    String dateString=Date Time.Now.ToStri ng("MM/dd/yyyy");
    Console.WriteLi ne(dateString);

    note that the 'MM' portion is in CAPS.

    David

    "Florida . NET Coder" <NoSpam@Florida Development.com > wrote in message
    news:eeDBeOGvEH A.2192@TK2MSFTN GP14.phx.gbl...[color=blue]
    > 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.
    >
    >[/color]


    Comment

    • James Curran

      #3
      Re: How to format date in MMDDYYY format?

      "Florida . NET Coder" <NoSpam@Florida Development.com > wrote in message
      news:eeDBeOGvEH A.2192@TK2MSFTN GP14.phx.gbl...[color=blue]
      > 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.[/color]

      DateTime dt = DateTime.Now;

      Console.WriteLi ne("{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


      Comment

      Working...