//ISO日期转换为UTC日期 public XMLGregorianCalendar xmlToDate(Date date){ GregorianCalendar cal = new GregorianCalendar(); cal.setTime(date); XMLGregorianCalendar gc = null; try { gc = DatatypeFactory.newInstance().newXMLGregorianCalendar(cal); } catch (Exception e) { e.printStackTrace(); } return gc; } //UTC日期转换为ISO日期 public Date DateToXML(XMLGregorianCalendar gc){ GregorianCalendar ca = gc.toGregorianCalendar(); return ca.getTime(); }
时间: 2024-11-05 22:35:22