Hi Jakub,
Thank you for your reply.

I used the code and I am getting the output as 

DATE IS: Sun Dec 31 00:01:05 EST 1899

But, I would like to get the same time as in the cell as 00:01:05.13 and is
formatted as hh\:mm\:ss.00.

Please help me to get the time.

Thanks,
Maria


jakub kuzela wrote:
> 
> Hi,
> 
> if you want create cell with format hh:mm:ss.00 u can do this:
> 
>      HSSFCellStyle cellData = wb.createCellStyle();
>      HSSFDataFormat formatData = wb.createDataFormat();
>      cellData.setDataFormat(formatData.getFormat("hh:mm:ss.00"));
> 
>      HSSFWorkbook wb = new HSSFWorkbook();
>      HSSFSheet sheet = wb.createSheet("new sheet");
>      HSSFRow row = sheet.createRow((short)0);
> 
>      cell = row.createCell((short)1);
>      cell.setCellStyle(cellStyle);
>      java.util.Date utilDate = new java.util.Date();
>      cell.setCellValue(utilDate);
> 
> if you want read this cell back you can do this:
> 
>     InputStream inp = new FileInputStream("D:/workbook.xls");
> 
>     wb = new HSSFWorkbook(new POIFSFileSystem(inp));
>     sheet = wb.getSheet("new sheet");
>     row = sheet.getRow((short)0);
>     cell = row.getCell((short)1);
> 
>     java.util.Date readDate = cell.getDateCellValue();
>     System.out.println("DATE IS: "+readDate);
> 
> Is this what you ask?
> 
> Jakub.
> 
> 
> 
> 2008/4/14, Nick Burch <[EMAIL PROTECTED]>:
>>
>> On Fri, 11 Apr 2008, mariag wrote:
>>
>> > I am new to this HSSF. I have an urgent requirement to read an excel
>> > file.
>> > But it has a time field that I don't know how to read it.
>> >
>> > Can anyone please help me in reading a date cell with excel custom
>> > format hh\:mm\:ss.00? if I have the value in the cell as
>> 00.00.18.13,excel is displaying itas 12:00:18 AM.
>> >
>>
>> I'm not sure quite what you're after, but have you tried reading:
>>        http://poi.apache.org/hssf/quick-guide.html#CreateDateCells
>>        http://poi.apache.org/hssf/quick-guide.html#DataFormats
>> ?
>>
>> Nick
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
> 
> 

-- 
View this message in context: 
http://www.nabble.com/read-custom-format-date-hh%3Amm%3Ass%3A00%E2%80%8F-tp16628223p16677658.html
Sent from the POI - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to