Formatar campo data-hora em planilha Excel

Bom dia,
Preciso de ajuda para formatar um campo data-hora.
Atualmente ele só exibe Data, preciso alterá-lo para exibir também a hora.
Alguém pode me ajudar

HSSFWorkbook wb = new HSSFWorkbook();
HSSFSheet sheet = wb.createSheet(“Alunos”);
HSSFRow row = sheet.createRow(0);

HSSFCellStyle estilo = wb.createCellStyle();
estilo.setDataFormat(HSSFDataFormat.getBuiltinFormat(“m/d/yy”));

HSSFCell celulaAlunoDataInsc = rows.createCell((short)36);
celulaAlunoDataInsc.setCellValue(c.getAlunoDatahora_inscr());
celulaAlunoDataInsc.setCellStyle(estilo);

Tenta assim:

HSSFCellStyle estilo = wb.createCellStyle();
estilo.setDataFormat(HSSFDataFormat.getBuiltinFormat("m/d/yy h:mm"));

Olá… Não funcionou.
Ao invés de trazer a hora que está no banco ele colocou 00:00

estilo.setDataFormat(HSSFDataFormat.getBuiltinFormat(“m/d/yy h:mm”));

Será que deveria ser outra coisa ao invés de DataFormat?

olá

http://poi.apache.org/hssf/quick-guide.html

nesse link explica varias formatacoes para o excel… espero q ajude :slight_smile:

Fiz o teste aqui e funcionou blz…

Seguindo o exemplo disponível em : http://poi.apache.org/hssf/quick-guide.html#CreateDateCells

public static void main(String[] args) throws IOException {
		 HSSFWorkbook wb = new HSSFWorkbook();
		    HSSFSheet sheet = wb.createSheet("new sheet");

		    // Create a row and put some cells in it. Rows are 0 based.
		    HSSFRow row = sheet.createRow((short)0);

		    // Create a cell and put a date value in it.  The first cell is not styled
		    // as a date.
		    HSSFCell cell = row.createCell((short)0);
		    cell.setCellValue(new Date());

		    // we style the second cell as a date (and time).  It is important to
		    // create a new cell style from the workbook otherwise you can end up
		    // modifying the built in style and effecting not only this cell but other cells.
		    HSSFCellStyle cellStyle = wb.createCellStyle();
		    cellStyle.setDataFormat(HSSFDataFormat.getBuiltinFormat("m/d/yy h:mm"));
		    cell = row.createCell((short)1);
		    cell.setCellValue(new Date());
		    cell.setCellStyle(cellStyle);

		    // Write the output to a file
		    FileOutputStream fileOut = new FileOutputStream("workbook.xls");
		    wb.write(fileOut);
		    fileOut.close();

	}

Usei a versão “poi-bin-3.5-beta3-20080926.zip”