return newXMLGregorianCalendarTime( hours, minutes,
GregorianCalendar cal = new GregorianCalendar(); cal.setTime(yourDate); XMLGregorianCalendar xmlDate = DatatypeFactory.newInstance().newXMLGregorianCalendarDate(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH)+1, cal.get(Calendar.DAY_OF_MONTH), 0); XMLGregorianCalendar xmlTime = DatatypeFactory.newInstance().newXMLGregorianCalendarTime(cal.get(Calendar.HOUR_OF_DAY), cal.get(Calendar.MINUTE), cal.get(Calendar.SECOND), 0);
public XMLGregorianCalendar newXMLGregorianCalendarTime(int hours, int minutes, int seconds, BigDecimal fractionalSecond, int timezone) { return actual.newXMLGregorianCalendarTime(hours, minutes, seconds, fractionalSecond, timezone); }
public XMLGregorianCalendar newXMLGregorianCalendarTime(int hours, int minutes, int seconds, int milliseconds, int timezone) { return actual.newXMLGregorianCalendarTime(hours, minutes, seconds, milliseconds, timezone); } }
public XMLGregorianCalendar newXMLGregorianCalendarTime(int hours, int minutes, int seconds, int timezone) { return actual.newXMLGregorianCalendarTime(hours, minutes, seconds, timezone); }
XMLGregorianCalendar time = DatatypeFactory.newInstance() .newXMLGregorianCalendarTime(xgc.getHour(), xgc.getMinute(), xgc.getSecond(), xgc.getFractionalSecond(), xgc.getTimezone());
public class TimeFromDateAdapter extends XmlAdapter<XMLGregorianCalendar, Date> { public Date unmarshal(XMLGregorianCalendar value) { Calendar cal = value.toGregorianCalendar(); Date d = cal.getTime(); return d; } public XMLGregorianCalendar marshal(Date value) { Calendar cal = Calendar.getInstance(); cal.setTime(value); try { XMLGregorianCalendar xmlcal = DatatypeFactory.newInstance().newXMLGregorianCalendarTime(cal.get(Calendar.HOUR_OF_DAY), cal.get(Calendar.MINUTE), cal.get(Calendar.SECOND), 0); return xmlcal; } catch (Exception e) { e.printStackTrace(); return null; } } }
public XMLGregorianCalendar newXMLGregorianCalendarTime( final int hours, final int minutes, final int seconds, final int milliseconds, final int timezone) { BigDecimal realMilliseconds = null; if (milliseconds != DatatypeConstants.FIELD_UNDEFINED) { if (milliseconds < 0 || milliseconds > 1000) { throw new IllegalArgumentException( "javax.xml.datatype.DatatypeFactory#newXMLGregorianCalendarTime(" + "int hours, int minutes, int seconds, int milliseconds, int timezone)" + "with invalid milliseconds: " + milliseconds ); } realMilliseconds = BigDecimal.valueOf((long) milliseconds).movePointLeft(3); } return newXMLGregorianCalendarTime( hours, minutes, seconds, realMilliseconds, timezone ); } }
private static TimeValue newUtcTimeValue(final int hours, final int minutes, final int seconds, final int nanoOfSec) { return TimeValue.getInstance(XmlUtils.XML_TEMPORAL_DATATYPE_FACTORY.newXMLGregorianCalendarTime(hours, minutes, seconds, BigDecimal.valueOf(nanoOfSec).movePointLeft(9), 0)); }
@Override public String format(Object value) { if (value == null) { return null; } Calendar cal = (Calendar) value; if (pattern != null) { return super.formatCalendar(cal); } int ms = DatatypeConstants.FIELD_UNDEFINED; if (outputMilliseconds) { ms = cal.get(Calendar.MILLISECOND); } XMLGregorianCalendar xcal = dataTypeFactory.newXMLGregorianCalendarTime( cal.get(Calendar.HOUR_OF_DAY), cal.get(Calendar.MINUTE), cal.get(Calendar.SECOND), ms, getTimeZoneOffset(cal.getTime())); return xcal.toXMLFormat(); }
@Override public String format(Object value) { if (value == null) { return null; } Date date = (Date) value; if (pattern != null) { return super.formatDate(date); } Calendar cal = newCalendar(); cal.setTime(date); int ms = DatatypeConstants.FIELD_UNDEFINED; if (outputMilliseconds) { ms = cal.get(Calendar.MILLISECOND); } XMLGregorianCalendar xcal = dataTypeFactory.newXMLGregorianCalendarTime( cal.get(Calendar.HOUR_OF_DAY), cal.get(Calendar.MINUTE), cal.get(Calendar.SECOND), ms, getTimeZoneOffset(date)); return xcal.toXMLFormat(); }
gc.get(Calendar.MONTH) + 1, FIELD_UNDEFINED, FIELD_UNDEFINED); case XQBASETYPE_TIME: return dtFactory.newXMLGregorianCalendarTime(gc.get(HOUR), gc.get(MINUTE), gc.get(SECOND), gc.get(MILLISECOND), gc.get(ZONE_OFFSET));
return newXMLGregorianCalendarTime( hours, minutes,
return newXMLGregorianCalendarTime( hours, minutes,
return newXMLGregorianCalendarTime( hours, minutes,
s = value.getSeconds(); i = (int) (value.getTime() % 1000); xcal = factory.newXMLGregorianCalendarTime(h, m, s, i, z); break; case TIMESTAMP:
.newInstance().newXMLGregorianCalendar(); final XMLGregorianCalendar xmlCalendar = DatatypeFactory .newInstance().newXMLGregorianCalendarTime(gCalendar.get(Calendar.HOUR), gCalendar.get(Calendar.MINUTE), gCalendar.get(Calendar.SECOND), xmlTZ.getTimezone());
public XMLGregorianCalendar getXmlDuration() throws DatatypeConfigurationException { long dataSize = this.getRcRiffDataChunk().getChunkSize(); long blockSize = this.getRcRiffFmtChunk().getBlockAlign(); long numSampleFrames = dataSize / blockSize; long samplesPerSec = this.getRcRiffFmtChunk().getSamplesPerSec(); long ms = (long) (numSampleFrames / (samplesPerSec / 1000D)); int hours = (int) (ms / (60 * 60 * 1000)); ms -= hours * 60 * 60 * 1000; int min = (int) (ms / (60 * 1000)); ms -= min * 60 * 1000; int sec = (int) (ms / 1000); ms -= sec * 1000; XMLGregorianCalendar duration = DatatypeFactory.newInstance().newXMLGregorianCalendarTime(hours, min, sec, (int) ms, DatatypeConstants.FIELD_UNDEFINED); return duration; }
ms -= sec * 1000; XMLGregorianCalendar duration = DatatypeFactory.newInstance().newXMLGregorianCalendarTime(hours, min, sec, (int) ms, DatatypeConstants.FIELD_UNDEFINED);
xmlCalendar = _datatypeFactory.newXMLGregorianCalendar((GregorianCalendar)time.normalizeCalendar(time.calendar(), time.tz())); } else { xmlCalendar = _datatypeFactory.newXMLGregorianCalendarTime(time.hour(), time.minute(), (int)time.second(), 0);