I am writing a program that pulls data from a CSV file (which, due to the structure, is easier to work with through Excel). There are columns that hold a date and time. The date column processes correctly, yet the time column (F) is being interpreted as a double. For example, in the following loop, it sees the value as 0.00 on the first loop, 0.25 on the second, 0.26041666666666669 on the third, 0.27083333333333331o on the fourth iteration, and so on.
for (i = startRow; i <= endRow; i++)
{
PeriodSales saleRow = new PeriodSales();
DateTime saleDate = Convert.ToDateTime((sheet.Cells[i, 5] as Excel.Range).Value);
var timeString = (sheet.Cells[i, 6] as Excel.Range).Value;
DateTime timeOfSale;
timeOfSale = new DateTime(saleDate.Year, saleDate.Month, saleDate.Day, 0, 0, 0);
// the lines below were commented out for testing purposes
(so I could see the value of timeString in the loop */
/* if (timeString != "0")
{
String[] timeArray = timeString.Split(':');
timeOfSale = new DateTime(saleDate.Year, saleDate.Month, saleDate.Day, Convert.ToInt32(timeArray[0]), Convert.ToInt32(timeArray[1]), 0);
}
else
{
timeOfSale = new DateTime(saleDate.Year, saleDate.Month, saleDate.Day, 0, 0, 0);
} */
Attached is a screenshot of my spreadsheet/CSV
The underlying CSV (in Notepad++)