How to set format to ToString("MM/dd/yyyy")?

Posted on 2010-01-04
Last Modified: 2013-11-26
I am trying to set format to a DATETIME var while passing it to a string.

I am getting the error: Error 4 Cannot implicitly convert type 'string' to 'System.DateTime?'
Question by:Rahn
    LVL 13

    Expert Comment


    Convert.ToDateTime("1 Jan 200")

    Open in new window

    LVL 13

    Expert Comment

    2000 :)

    Convert.ToDateTime("1 Jan 2000")

    Open in new window

    LVL 13

    Accepted Solution

    Really sorry man

    Convert.ToDateTime("1 Jan 2000").ToString("dd/MM/yyyy")

    Open in new window


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
    Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
    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!
    Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

    760 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

    7 Experts available now in Live!

    Get 1:1 Help Now