public Calendar parseDateTime(String value) { XSDDateTimeFormat format = new XSDDateTimeFormat(); ParsePosition pos = new ParsePosition(0); Calendar cal = (Calendar) format.parseObject(value, pos); if (cal == null) { String message = logger.getResourceBundle().getString("BadDateTime"); message = message.replace("{0}", value); message = message.replace("{1}", value.substring(pos.getErrorIndex())); throw new IllegalArgumentException(message); } return cal; }
year = -year; append(pBuffer, year, 4); pBuffer.append('-'); append(pBuffer, cal.get(Calendar.MONTH) + 1, 2); pBuffer.append('-'); append(pBuffer, cal.get(Calendar.DAY_OF_MONTH), 2); if (parseTime) { pBuffer.append('T'); append(pBuffer, cal.get(Calendar.HOUR_OF_DAY), 2); pBuffer.append(':'); append(pBuffer, cal.get(Calendar.MINUTE), 2); pBuffer.append(':'); append(pBuffer, cal.get(Calendar.SECOND), 2); int millis = cal.get(Calendar.MILLISECOND); if (millis > 0) { pBuffer.append('.'); append(pBuffer, millis, 3); int hours = minutes / 60; minutes -= hours * 60; append(pBuffer, hours, 2); pBuffer.append(':'); append(pBuffer, minutes, 2);
offset = parseInt(pString, offset, digits); if (digits.length() < 4) { pParsePosition.setErrorIndex(offset); offset = parseInt(pString, offset, digits); if (digits.length() != 2) { pParsePosition.setErrorIndex(offset); offset = parseInt(pString, offset, digits); if (digits.length() != 2) { pParsePosition.setErrorIndex(offset); int millis = 0; if (parseTime) { offset = parseInt(pString, offset, digits); if (digits.length() != 2) { pParsePosition.setErrorIndex(offset); offset = parseInt(pString, offset, digits); if (digits.length() != 2) { pParsePosition.setErrorIndex(offset); offset = parseInt(pString, offset, digits); if (digits.length() != 2) { pParsePosition.setErrorIndex(offset); offset = parseInt(pString, offset, digits); if (digits.length() > 0) { millis = Integer.parseInt(digits.toString());
offset = parseInt(pString, offset, digits); if (digits.length() < 4) { pParsePosition.setErrorIndex(offset); offset = parseInt(pString, offset, digits); if (digits.length() != 2) { pParsePosition.setErrorIndex(offset); offset = parseInt(pString, offset, digits); if (digits.length() != 2) { pParsePosition.setErrorIndex(offset); int millis = 0; if (parseTime) { offset = parseInt(pString, offset, digits); if (digits.length() != 2) { pParsePosition.setErrorIndex(offset); offset = parseInt(pString, offset, digits); if (digits.length() != 2) { pParsePosition.setErrorIndex(offset); offset = parseInt(pString, offset, digits); if (digits.length() != 2) { pParsePosition.setErrorIndex(offset); offset = parseInt(pString, offset, digits); if (digits.length() > 0) { millis = Integer.parseInt(digits.toString());
year = -year; append(pBuffer, year, 4); pBuffer.append('-'); append(pBuffer, cal.get(Calendar.MONTH) + 1, 2); pBuffer.append('-'); append(pBuffer, cal.get(Calendar.DAY_OF_MONTH), 2); if (parseTime) { pBuffer.append('T'); append(pBuffer, cal.get(Calendar.HOUR_OF_DAY), 2); pBuffer.append(':'); append(pBuffer, cal.get(Calendar.MINUTE), 2); pBuffer.append(':'); append(pBuffer, cal.get(Calendar.SECOND), 2); int millis = cal.get(Calendar.MILLISECOND); if (millis > 0) { pBuffer.append('.'); append(pBuffer, millis, 3); int hours = minutes / 60; minutes -= hours * 60; append(pBuffer, hours, 2); pBuffer.append(':'); append(pBuffer, minutes, 2);
public String printDateTime(Calendar value) { return new XSDDateTimeFormat().format(value); }
public String printDateTime(Calendar value) { return new XSDDateTimeFormat().format(value); }
public Calendar parseDateTime(String value) { XSDDateTimeFormat format = new XSDDateTimeFormat(); ParsePosition pos = new ParsePosition(0); Calendar cal = (Calendar) format.parseObject(value, pos); if (cal == null) { String message = logger.getResourceBundle().getString("BadDateTime"); message = message.replace("{0}", value); message = message.replace("{1}", value.substring(pos.getErrorIndex())); throw new IllegalArgumentException(message); } return cal; }