Currently in EventDetails Datatable startdate item is showing as 42174.696527777778
From your description, as we can see that the data is not date time type. I suggest you check the excel file and the EventDetails datatable, to make sure the start date item is date type first.
Best regards,
Dillion
.NET forums are moving to a new home on Microsoft Q&A, we encourage you to go to Microsoft Q&A for .NET for posting new questions and get involved today.
The issue is that Excel doesn't really hide that dates are actually stored as numbers and so if reading a value in Excel you may see a date while reading the same sheet with an ODBC driver etc... may show the actual underlying numeric value for this date.
Member
17 Points
151 Posts
XMLWriter is taking Different Date Format
Sep 29, 2015 11:13 AM|sreekanth.jonna|LINK
Hi,
I am trying to genrate XML files out of excel file, I am using below code to generate XML but the date format it is showing in DataTable is different.
Expected Output is : 6/19/2015
Currently in EventDetails Datatable startdate item is showing as 42174.696527777778
Please advice
Thanks
Sree
All-Star
45489 Points
7008 Posts
Microsoft
Re: XMLWriter is taking Different Date Format
Sep 30, 2015 02:19 AM|Zhi Lv - MSFT|LINK
Hi Sree,
From your description, as we can see that the data is not date time type. I suggest you check the excel file and the EventDetails datatable, to make sure the start date item is date type first.
Best regards,
Dillion
All-Star
48510 Points
18072 Posts
Re: XMLWriter is taking Different Date Format
Jul 27, 2016 05:27 PM|PatriceSc|LINK
Hi,
Try to call https://msdn.microsoft.com/en-us/library/system.datetime.fromoadate(v=vs.110).aspx on this value. Does it show the expected date?
The issue is that Excel doesn't really hide that dates are actually stored as numbers and so if reading a value in Excel you may see a date while reading the same sheet with an ODBC driver etc... may show the actual underlying numeric value for this date.