List of usage examples for org.apache.poi.ss.usermodel DateUtil getExcelDate
public static double getExcelDate(Calendar date, boolean use1904windowing)
From source file:org.eclipse.emfforms.internal.spreadsheet.core.converter.EMFFormsSpreadsheetSingleAttributeConverter_Test.java
License:Open Source License
@Test public void testGetCellValueXmlDate() throws EMFFormsConverterException { final XMLGregorianCalendar cellValue = new XMLCalendar(Calendar.getInstance(UTC_TIMEZONE).getTime(), XMLCalendar.DATE);/*from w w w .j a v a 2 s . com*/ cellValue.setTimezone(DatatypeConstants.FIELD_UNDEFINED); cellValue.setHour(DatatypeConstants.FIELD_UNDEFINED); cellValue.setMinute(DatatypeConstants.FIELD_UNDEFINED); cellValue.setSecond(DatatypeConstants.FIELD_UNDEFINED); cellValue.setMillisecond(DatatypeConstants.FIELD_UNDEFINED); cell.setCellValue(DateUtil.getExcelDate(cellValue.toGregorianCalendar(UTC_TIMEZONE, null, null), false)); final EDataType dataType = EcoreFactory.eINSTANCE.createEDataType(); dataType.setInstanceClass(XMLGregorianCalendar.class); final EAttribute eAttribute = EcoreFactory.eINSTANCE.createEAttribute(); eAttribute.setEType(dataType); final Object value = converter.getCellValue(cell, eAttribute); final XMLGregorianCalendar result = (XMLGregorianCalendar) value; assertEquals(cellValue, result); }