Date format

Posted on 2011-10-24
Last Modified: 2012-05-12
in c#, what is the code to get a date out to a string in this format...

mmddyyyy  (all together, no dashes or spaces)

I'm wanting to append this on a variable holding a file name.



Question by:carsRST
    LVL 23

    Accepted Solution

    Try this code
    DateTime time = DateTime.Now;              
    string format = "MMddyyyy";    
    format = time.ToString(format);

    Open in new window

    LVL 16

    Author Closing Comment

    Thank you so much!
    LVL 23

    Expert Comment

    by:Rajkumar Gs

    Featured Post

    6 Surprising Benefits of Threat Intelligence

    All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

    Join & Write a Comment

    Suggested Solutions

    Article by: Ivo
    Anonymous Types in C# by Ivo Stoykov Anonymous Types are useful when  we do not need to follow usual work-flow -- creating object of some type, assign some read-only values and then doing something with them. Instead we can encapsulate this read…
    It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    729 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

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now