Issue 14735 - Date format changed from MM/DD/YYYY to MM/DD/YY on import/export of Excel 2002 file
Summary: Date format changed from MM/DD/YYYY to MM/DD/YY on import/export of Excel 200...
Status: CLOSED FIXED
Alias: None
Product: Calc
Classification: Application
Component: code (show other issues)
Version: OOo 1.1 Beta2
Hardware: PC Windows XP
: P4 Trivial with 1 vote (vote)
Target Milestone: ---
Assignee: john.marmion
QA Contact: issues@sc
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-05-22 08:39 UTC by drensink
Modified: 2013-08-07 15:15 UTC (History)
1 user (show)

See Also:
Issue Type: ENHANCEMENT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments
Test Case (15.00 KB, application/octet-stream)
2003-05-28 09:43 UTC, drensink
no flags Details

Note You need to log in before you can comment on or make changes to this issue.
Description drensink 2003-05-22 08:39:40 UTC
When opening an Excel 2002 file which has a date entered and displayed in the 
format MM/DD/YYYY such as 05/21/2003 OpenOffice 1.1 Beta interprets that date 
as 05/21/03 and upon saving back in Excel format and opening with Excel 2002 
the data file has been changed so that Excel also interprets the date as 
05/21/03.  The format that the date was originally entered and displayed as 
must be in the Excel file somewhere and should not be misinterpreted to a 
different storage and display format by OpenOffice 1.1 Beta.  The file was 
saved on Windows XP Professional SP1, Office XP Professional SP2 and opened on 
Windows ME, OpenOffice 1.1 Beta then transferred back to the first setup.
Comment 1 john.marmion 2003-05-22 16:03:40 UTC
My assumption without an accompanying attached document is that the 
dates entered are in 'short date' format i.e. as determined by the 
regional settings. This is the default Excel date format. If you 
select 'format cells->Number->Date', the two '*' before the date 
formats determine the system short and long date formats. If you use 
the short date format, then Excel simply stores this fact and not the 
actual format i.e. MM/DD/YYYY. The corresponding short date format in 
Calc is MM/DD/YY. Remember we have to be able to cope with 
localisation issues. This same 'short date' format will appear as 
DD/MM/YY or DD.MM.YY in other locals and your short date format may 
be different on someone's else's machine. 

So to ensure compatability across applications and machines, you 
could have explicitly chosen to set your date format to MM/DD/YYYY in 
format cells ->Number->Date->Type. 

If this assumption is incorrect, please attach a sample doc. Thanks.
Comment 2 drensink 2003-05-28 09:43:33 UTC
Created attachment 6484 [details]
Test Case
Comment 3 john.marmion 2003-05-28 12:19:23 UTC
The attached doc confirms that the dates are in short-date format. 
The problem is that Excel file does not contain the format m/d/yyyy 
as you suggest but rather it stores the format as an index to a built-
in table. We don't know what the format of the original doc is in. 
This explains why Excel will display the same date differently on two 
machines with different short-date format settings. 

Calc simply uses the short date m/d/yy for the US locale. Thus to 
ensure compatability across machines and across applications, you 
should employ the workaround and explicity set the date format as 
suggested earlier. This workaround would also ensure consistency in 
the round trip of Excel to Calc to Excel. 

I would add that one improvement we should do would be to ensure that 
instead of exporting the built-in format to a user-defined format, we 
could export it as the original built-in index number. I would 
willingly confirm that as an issue and use this issue as a 
placeholder for such a change.

Comment 4 drensink 2003-05-28 16:28:36 UTC
I should have clarified, the original document in the test case was 
done in Excel 97.  I didn't have Excel 2002 available at the time, 
but it exhibits the same behavior.  

I don't think I was explaining myself well at first, but your 
suggestion for improvement in export seems to be right on. That
would at least prevent it from changing on the Excel side while 
allowing OpenOffice to handle it in any manner.



Comment 5 john.marmion 2003-05-28 16:58:21 UTC
confirming request to export Excel built-in formats rather than user-
defined formats
Comment 6 john.marmion 2003-05-28 16:59:43 UTC
assuming ownership + target
Comment 7 john.marmion 2003-05-28 17:00:30 UTC
reset to started
Comment 8 philmperry 2003-07-13 01:41:32 UTC
I encounter the same/similar problem when simply entering a date in
mm/dd/yyyy format, but using the default cell format (in USA), which
is mm/dd/yy. The full 4-digit year is still in the data, but is
displayed as a 2-digit year. What I would like Calc's behavior to be
is, if a year is entered as four digits (e.g. mm/dd/yyyy) that the
default format for that locale be selected as the one with a 4-digit
year, rather than the one with a 2-digit year. If the user explicitly
selects a date format, then of course that should be followed, but if
the format is allowed to default, it should show the full four digits
of the year if that is what was entered.
Comment 9 john.marmion 2003-07-14 15:35:08 UTC
I want to try and clarify this. This issue is solely concerned with
the import and export of date formats from Excel documents and not how
Calc formats dates as they are entered by a user.
Comment 10 philmperry 2003-07-15 04:06:11 UTC
OK, then I will open a new issue
Comment 11 john.marmion 2003-07-15 17:48:10 UTC
Marking this as fixed. I have recently checked in some code to fix
issue 13557 and an internal bug to address some CJK and date/time
formatting issues to xistyle.cxx. The result is that we now default
Excel docs containing the Excel short date to using YYYY rather than
YY as this is the windows default short date format. This fix is now
in CWS/calc16.  
Comment 12 frank 2003-08-07 15:39:57 UTC
set to verified
Comment 13 frank 2003-08-07 15:41:46 UTC
closed verified
Comment 14 frank 2003-08-08 07:53:41 UTC
closed accidentially, so reopening

Frank
Comment 15 frank 2003-08-08 07:55:08 UTC
restoring status as fixed.

Frank

Comment 16 oc 2003-08-08 15:17:59 UTC
*** Issue 18029 has been marked as a duplicate of this issue. ***
Comment 17 oc 2003-08-11 09:42:28 UTC
*** Issue 18029 has been marked as a duplicate of this issue. ***
Comment 18 bettina.haberer 2003-12-10 10:01:11 UTC
closed.