-1

I am trying to parse a integer(like 43392) to a date time.

The code looks like this:

DateTime d = DateTime.ParseExact(item[11], "dd/MM/yyyy", CultureInfo.InvariantCulture);

wher item[11] is "43392".

This throws an System.FormatException error, string was not recognized as a valid Datetime.

Need some guidance on this.

lakshmen
  • 28,346
  • 66
  • 178
  • 276

1 Answers1

3

This should work

DateTime dateTime = DateTime.FromOADate(43392);

Output

19/10/2018 12:00:00 AM

DateTime.FromOADate Method (Double)

Returns a DateTime equivalent to the specified OLE Automation Date.

TheGeneral
  • 79,002
  • 9
  • 103
  • 141