
This little snippet here will allow you to convert excel encoded date to standard Windows DateTime.
public static DateTime ExcelDateConverter(int excelDateSerial)
{
if (excelDateSerial <>
{
excelDateSerial++;
}
return new DateTime((excelDateSerial + 693593) * (10000000L * 24 * 3600));
}
Back to Home


2 comments:
Why dont u use DateTime.FromOADate(double d) (standard 1.1.4 framework)??
It works perfectly when u have a datetime column in excel and then convert it to text. It will result in a int number. This method convert it to a datetime again.
Dear Anonymous,
can you explain your method please...
Post a Comment