Galera gostaria de saber como eu formato a data quando eu exportar os dados para o excel,
segue codigo.
no caso a após exportar o campo da minha tabela fica com data e hora no formato ingles,
e eu gostaria que ficasse só a hora no formato brasileiro
AGRADEÇO DESDE JÀ!!
public void exportXLS(String url) throws IOException, SQLException{
int i = 1;
HSSFWorkbook wb = new HSSFWorkbook();
HSSFSheet sheet1 = wb.createSheet("Dados");
HSSFRow coluna1 = sheet1.createRow(0);
HSSFRow coluna2 = sheet1.createRow(0);
HSSFRow coluna3 = sheet1.createRow(0);
HSSFRow coluna4 = sheet1.createRow(0);
HSSFRow coluna5 = sheet1.createRow(0);
HSSFRow coluna6 = sheet1.createRow(0);
HSSFRow coluna7 = sheet1.createRow(0);
HSSFRow coluna8 = sheet1.createRow(0);
HSSFRow coluna9 = sheet1.createRow(0);
HSSFRow coluna10 = sheet1.createRow(0);
HSSFRow coluna11 = sheet1.createRow(0);
coluna1.createCell(0).setCellValue("ID Produção");
coluna2.createCell(1).setCellValue("Turno");
coluna3.createCell(2).setCellValue("Contador");
coluna4.createCell(3).setCellValue("Cod Maquina");
coluna5.createCell(4).setCellValue("Cod Operador");
coluna6.createCell(5).setCellValue("Cod Molde");
coluna7.createCell(6).setCellValue("Cod Peça");
coluna8.createCell(7).setCellValue("Data Movto");
coluna9.createCell(8).setCellValue("Hora");
coluna10.createCell(9).setCellValue("Juliano");
coluna11.createCell(10).setCellValue("Nome Cliente");
this.url = url;
con_MovtoTurno = new Conexao_banco();
con_MovtoTurno.conecta(url);
con_MovtoTurno.executeSQL("SELECT * FROM movto_producao where dt_movto>= '"+tfDataInicio.getText()+"' and dt_movto<= '"+tfDataFinal.getText()+"' ");
//=================================================================================
/* METODO DE CONVERSÃO*/
HSSFSheet sheet = wb.createSheet();
HSSFCellStyle styleData = wb.createCellStyle();
HSSFDataFormat format = wb.createDataFormat();
styleData.setDataFormat(format.getFormat("dd/mm/yy"));
cell.setCellStyle(styleData); //ESTA DANDO ERRO NO "cell"
//=================================================================================
try{
while (con_MovtoTurno.resultset.next()){
coluna1 = sheet1.createRow(i);
coluna2 = sheet1.createRow(i);
coluna3 = sheet1.createRow(i);
coluna4 = sheet1.createRow(i);
coluna5 = sheet1.createRow(i);
coluna6 = sheet1.createRow(i);
coluna7 = sheet1.createRow(i);
coluna8 = sheet1.createRow(i);
coluna9 = sheet1.createRow(i);
coluna10 = sheet1.createRow(i);
coluna11 = sheet1.createRow(i);
coluna1.createCell(0).setCellValue(con_MovtoTurno.resultset.getString("id_producao"));
coluna2.createCell(1).setCellValue(con_MovtoTurno.resultset.getString("turno"));
coluna3.createCell(2).setCellValue(con_MovtoTurno.resultset.getString("contador"));
coluna4.createCell(3).setCellValue(con_MovtoTurno.resultset.getString("cod_maquina"));
coluna5.createCell(4).setCellValue(con_MovtoTurno.resultset.getString("cod_operador"));
coluna6.createCell(5).setCellValue(con_MovtoTurno.resultset.getString("cod_molde"));
coluna7.createCell(6).setCellValue(con_MovtoTurno.resultset.getString("cod_peca"));
coluna8.createCell(7).setCellValue(con_MovtoTurno.resultset.getString("dt_movto"));
coluna9.createCell(8).setCellValue(con_MovtoTurno.resultset.getString("hora"));
coluna10.createCell(9).setCellValue(con_MovtoTurno.resultset.getString("juliano"));
coluna11.createCell(10).setCellValue(con_MovtoTurno.resultset.getString("nome_cliente"));
i++;
}
con_MovtoTurno.resultset.close();
con_MovtoTurno.statment.close();
}
catch (Exception e){
e.printStackTrace();
}
FileOutputStream stream = new FileOutputStream("c:/tmp/relat_bodor.xls");
wb.write(stream);
stream.flush();
stream.close();
}