C#, ie 7.0, string format

Posted on 2007-08-06
Last Modified: 2013-12-17
I have created a datatable from a excel document.  I have a date that is reading in a number value like this 38718.  I need that value to be a small date value and converted into a string.  The tostring() method does not accomplish this
Question by:TroyCrowe
    LVL 53

    Expert Comment

    Did you try the tostring with a formatting ?
    LVL 25

    Accepted Solution

    You can use FromOADate to convert from OLE-Automation dates (which is what Excel uses) to .NET dates:

    string strDate = DateTime.FromOADate(38718).ToString();
    LVL 53

    Expert Comment

    Can you give some feedback if it one of the answer was sufficient or do you still have any problems ?

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Recently while returning home from work my wife (another .NET developer) was murmuring something. On further poking she said that she has been assigned a task where she has to serialize and deserialize objects and she is afraid of serialization. Wha…
    Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
    THe viewer will learn how to use NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.
    The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.

    758 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

    10 Experts available now in Live!

    Get 1:1 Help Now