How to Convert an Integer to a DateTime. RRS feed

  • Question

  • I am having difficulty , I have an integer to bring back the Date only, I dont have the time info as I dont need it.

    In VB6 i could convert the date to an integer and I hope C# has the sme functionality?

    Please help as the normal Convert.ToInt32 doesnt work:

    int idate = 24308;

      myDate = Convert.ToDateTime(idate);
      Console.WriteLine("DeathDate = {0}",myDate);
    catch(System.Exception ex)
      Console.WriteLine("exception = {0}", ex.ToString());

    Why wont this work?

    thanks in advance

    Wednesday, May 28, 2008 2:48 PM