private static DateTime parseIgnoreTrailingCharacters(DateTimeFormatter formatter, String text) {
// this is a modified version of DateTimeFormatter.parseDateTime() that does not
// throw an exception on trailing characters
Chronology chronology = DateTimeUtils.getChronology(null);
DateTimeParser parser = formatter.getParser();
Locale locale = null;
Integer pivotYear = null;
int defaultYear = 2000;
DateTimeZone timeZone = null;
DateTimeParserBucket bucket = new DateTimeParserBucket(0, chronology, locale, pivotYear, defaultYear);
int newPos = parser.parseInto(bucket, text, 0);
if (newPos >= 0) {
long millis = bucket.computeMillis(true, text);
if (formatter.isOffsetParsed() && bucket.getOffsetInteger() != null) {
int parsedOffset = bucket.getOffsetInteger();
DateTimeZone parsedZone = DateTimeZone.forOffsetMillis(parsedOffset);