Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Problems with dates in Excel
Message
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Title:
Problems with dates in Excel
Miscellaneous
Thread ID:
00703838
Message ID:
00703838
Views:
52
To all,

I wrote a fairly complex database import from an Excel file using automation. (Don't ask me to explain the reasons, that's simply what was decided) Anyway, someone brought to my attention recently that some of the dates were coming in incorrectly: they were one day off. I couldn't understand how that could be: the code for this has not changed in over 2 years.

So, I went looking. And sure enough, they were right. The dates were coming in wrong. I couldn't figure it out. Everything in the Excel file looks fine. It's showing the correct dates and it's using the 3/14/2001 format.

So, I went through the command window and typed the following:
o=CreateObject('excel.application')
o.Visible=.t.
o.Workbooks.Add()
ow=o.ActiveSheet
ow.Cells(1,1).Value = Transform({^1900/01/01})
?ow.Cells(1,1).Value && I get 12/31/1899 12:00:00 AM
ow.Cells(1,1).Value = Transform({^1900/01/02})
?ow.Cells(1,1).Value && I get 1/1/1900 12:00:00 AM
o.Workbooks.Close()
o.Quit()
I know this code worked perfectly before. And now in XP, I'm seeing this behavior. What's going on?!! Can someone tell me why this is happening or why MS thinks this behavior is acceptable?

TIA,

Travis
Travis Vandersypen
Next
Reply
Map
View

Click here to load this message in the networking platform