Bug: Reading Time Column Format.

Feb 5, 2013 at 3:16 PM
When you read DataTime or Data column format its all ok, but when it comes with Time format (HH:mm:ss) it shows bad result.
Here is example which genearates bug: https://docs.google.com/file/d/0B3MlWtD8GB3UTDdDM3I2cm5VeTA/edit?usp=sharing (choose File/Save)
Developer
Feb 5, 2013 at 3:20 PM
I'll take a look and let you know what I find.
Developer
Feb 5, 2013 at 3:59 PM
This may not be what you want to hear, but it seems to be correct.

Excel uses a 1900 based date system and a time without a date is set to January 0 1900 (yes, I know) which is the same as Dec 31 1899 which is what these fields read as.

My unit test (below) confirms that it is working as I expect, can you see anything wrong with it?
            var dataset = reader.AsDataSet();

            reader.Close();

            Assert.AreEqual(new System.DateTime(1899, 12, 31, 1, 34, 0), dataset.Tables[0].Rows[1][1]);
            Assert.AreEqual(new System.DateTime(1899, 12, 31, 1, 34, 0), dataset.Tables[0].Rows[2][1]);
            Assert.AreEqual(new System.DateTime(1899, 12, 31, 18, 47, 0), dataset.Tables[0].Rows[3][1]);
More info in this format from:
http://en.wikipedia.org/wiki/January_0 (scroll down to the Excel bit)
Google for 31/12/1899 and Excel, you'll find loads of people with this query.
Feb 6, 2013 at 7:41 AM
Edited Feb 6, 2013 at 7:41 AM
When i try to read this excel i don't have time in DataTime value.
Image
Developer
Feb 6, 2013 at 10:22 AM
I can see from that screenshot that you are using the Polish locale, I've seen some issues around locales which I think may be it.

I'll take another look with that locale but if you could also distil your your test code down to a small function and send me that as well, we can be sure we are addressing the same problem.
Developer
Feb 6, 2013 at 10:32 AM
Unable to get it to happen on Polish locale, could you send a small function that shows the issue or alternatively we can chat via Skype.