I have a Delphi application which reads data from an excel spreadsheet using code similar to the following:
procedure TForm1.Button1Click(Sender: TObject);
var
xlApp, xlWorkBook, xlWorkSheet, arr: Variant;
begin
xlApp := CreateOLEObject('Excel.Application');
xlApp.Visible := False;
xlWorkBook := xlApp.Workbooks.Open('C:\Temp\Book1.xlsx');
xlWorkSheet := xlApp.WorkSheets[1];
arr := xlWorksheet.Range['E2:E2'].Value;
xlApp.Quit;
end;
The value stored in the spreadsheet in cell E2:E2 is 10/01/1900 (dd/mm/yyyy). However, the value being returned is the 09/01/1900, ie the day before. Why is this happening as when it seems to be working correctly for all dates in other years from 1900 onwards?