Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have created a personal Excel document through zipping XML documents. The structure of this document is simpler than what Excel creates. The problem is that the date in this document is different between MacOS and Excel. MacOS have 4 years later than Windows. For example, if the date on windows is 2000-01-01, it will be 2004-01-01 on MacOS. But when I use Excel to create this document, the date is same. What's the reason?

share|improve this question

migrated from stackoverflow.com Nov 22 '12 at 19:32

This question came from our site for professional and enthusiast programmers.

1 Answer 1

up vote 2 down vote accepted

Mac Office uses timestamps with a reference date set at 1904 instead of 1900. Don't ask me why, perhaps it was to avoid this non-leap year...

Somewhere in the depths of Excel options (it varies with Excel versions, on my Excel 2010 for Windows, it is near the bottom of the Advanced Options), there is a check box telling to use a calendar starting at 1904.

share|improve this answer
1  
Reason as per the help file. –  Karan Nov 22 '12 at 19:47
    
Thanks for the info (although one can go one step further and ask why legacy programs chose a different starting date), and thanks for the edit (doing lap-dance with dates? :-D Mmm, it is even more a pun than I intended...) –  PhiLho Nov 23 '12 at 15:51
1  
Well, if you really want to go back in time... :) The date bug is thanks to the programmers of Lotus 1-2-3, who mistakenly thought 1900 was a leap year when it wasn't. You can read more on the subject in these two posts by Joel Spolsky, ex-Excel Program Manager and co-founder/CEO of StackExchange. –  Karan Nov 23 '12 at 16:11
    
Thanks for your anwser, I have checked the check box and compare the XML documents. There is an boolean attribute named date1904 of workbookPr element in workbook.xml. This attribute indicates which date system Excel should use. So I add <workbookPr date1904="false" /> in workbook.xml and the problem is solved. –  Joy Zhang Nov 26 '12 at 2:49

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.