Hi Nick, Thanks for the reply.
We receive about 100 spreadsheets from 3rd parties, I think getting them to add a ' prefix would not go over well. As for the formatting approach, since I also have legitimate dates, I'll have to convert to date, check if the year is 1899, if so, I know I'll have a time code and act accordingly. Kind of ugly, and problems will arise when time code values have been formatted by the user as text. In this case my date conversion/check will not work, as the cell will no longer be numeric. What's the 1904 date thing about? It is possible that some time codes will be stored as a value with 1904 as the epoch? I'd like to treat everything as strings by converting everything to the format seen by the user. But I don't see a way to use the format returned by HSSFDataFormat.getBuiltinFormat(cell.getCellStyle().getDataFormat())); In my tests, this method tends to throw an ArrayIndexOutOfBoundsException. Thanks > Date: Mon, 10 Dec 2007 16:18:10 +0000 > From: [EMAIL PROTECTED] > To: [email protected] > Subject: Re: HSSFCell Time Code String Treated as Date/Numeric > > On Fri, 7 Dec 2007, richard head wrote: > > I'm extracting dates and strings, some strings contain time code values > > i.e. "00:27:01". > > > > These values are designated as CELL_TYPE_NUMERIC > > Excel is wonderful like that. Almost everything is either a string or a > floating point number, and formatting is used to emulate all the different > possible data types off of those two. > > Either prefix your times with a ' when you enter them (so that excel will > treat them as a literal string, and not do anything "helpful" with them), > or just grab the floating point cell value and format it. It's almost > certainly going to seconds or miliseconds since midnight > > Nick > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > _________________________________________________________________ Share life as it happens with the new Windows Live.Download today it's FREE! http://www.windowslive.com/share.html?ocid=TXT_TAGLM_Wave2_sharelife_112007
