Java Code Examples for org.joda.time.format.DateTimeFormatterBuilder

The following examples show how to use org.joda.time.format.DateTimeFormatterBuilder. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
public TikaPoweredMetadataExtracter(String extractorContext, HashSet<String> supportedMimeTypes, HashSet<String> supportedEmbedMimeTypes)
{
    super(supportedMimeTypes, supportedEmbedMimeTypes);

    this.extractorContext = extractorContext;

    // TODO Once TIKA-451 is fixed this list will get nicer
    DateTimeParser[] parsersUTC = {
        DateTimeFormat.forPattern("yyyy-MM-dd'T'HH:mm:ss'Z'").getParser(),
        DateTimeFormat.forPattern("yyyy-MM-dd'T'HH:mm:ssZ").getParser()
    };
    DateTimeParser[] parsers = {
        DateTimeFormat.forPattern("yyyy-MM-dd'T'HH:mm:ss").getParser(),
        DateTimeFormat.forPattern("yyyy-MM-dd").getParser(),
        DateTimeFormat.forPattern("yyyy/MM/dd HH:mm:ss").getParser(),
        DateTimeFormat.forPattern("yyyy/MM/dd").getParser(),
            DateTimeFormat.forPattern("EEE MMM dd hh:mm:ss zzz yyyy").getParser()
    };

    this.tikaUTCDateFormater = new DateTimeFormatterBuilder().append(null, parsersUTC).toFormatter().withZone(DateTimeZone.UTC);
    this.tikaDateFormater = new DateTimeFormatterBuilder().append(null, parsers).toFormatter();
}
 
Example 2
Source Project: SolRDF   Source File: FieldInjectorRegistry.java    License: Apache License 2.0 6 votes vote down vote up
@Override
protected DateTimeFormatter initialValue() {
	return new DateTimeFormatterBuilder()
		.append(DateTimeFormat.forPattern("yyyy-MM-dd"))                                            
		.appendOptional(
				new DateTimeFormatterBuilder()
					.appendLiteral('T')
					.appendOptional(
							new DateTimeFormatterBuilder()
								.append(DateTimeFormat.forPattern("HH"))
								.appendOptional(
										new DateTimeFormatterBuilder()
											.append(DateTimeFormat.forPattern(":mm"))
												.appendOptional(
														new DateTimeFormatterBuilder()
															.append(DateTimeFormat.forPattern(":ss"))
														.toParser())
										.toParser())
							.toParser())
				.toParser())
		.toFormatter();
}
 
Example 3
Source Project: dremio-oss   Source File: JodaDateUtility.java    License: Apache License 2.0 5 votes vote down vote up
public static DateTimeFormatter getDateTimeFormatter() {

    if (dateTimeTZFormat == null) {
      DateTimeFormatter dateFormatter = DateTimeFormat.forPattern("yyyy-MM-dd");
      DateTimeParser optionalTime = DateTimeFormat.forPattern(" HH:mm:ss").getParser();
      DateTimeParser optionalSec = DateTimeFormat.forPattern(".SSS").getParser();
      DateTimeParser optionalZone = DateTimeFormat.forPattern(" ZZZ").getParser();

      dateTimeTZFormat = new DateTimeFormatterBuilder().append(dateFormatter).appendOptional(optionalTime)
        .appendOptional(optionalSec).appendOptional(optionalZone).toFormatter();
    }

    return dateTimeTZFormat;
  }
 
Example 4
Source Project: dremio-oss   Source File: JodaDateUtility.java    License: Apache License 2.0 5 votes vote down vote up
public static DateTimeFormatter getTimeFormatter() {
  if (timeFormat == null) {
    DateTimeFormatter timeFormatter = DateTimeFormat.forPattern("HH:mm:ss");
    DateTimeParser optionalSec = DateTimeFormat.forPattern(".SSS").getParser();
    timeFormat = new DateTimeFormatterBuilder().append(timeFormatter).appendOptional(optionalSec).toFormatter();
  }
  return timeFormat;
}
 
Example 5
Source Project: ETSMobile-Android2   Source File: Helper.java    License: Apache License 2.0 5 votes vote down vote up
public static DateTime ConvertFromWebService(String strDate) {
	DateTimeFormatter parser1 = new DateTimeFormatterBuilder().append(ISODateTimeFormat.date()).appendLiteral('T')
			.append(ISODateTimeFormat.hourMinuteSecond()).appendOptional(fractionElement())
			.appendOptional(offsetElement()).toFormatter().withZone(DateTimeZone.UTC);
	parser1.withChronology(ISOChronology.getInstanceUTC());
	return parser1.parseDateTime(strDate);
}
 
Example 6
Source Project: coming   Source File: Cardumen_00189_s.java    License: MIT License 5 votes vote down vote up
/**
 * Gets a printer/parser for managing the offset id formatting.
 * 
 * @return the formatter
 */
private static synchronized DateTimeFormatter offsetFormatter() {
    if (cOffsetFormatter == null) {
        cOffsetFormatter = new DateTimeFormatterBuilder()
            .appendTimeZoneOffset(null, true, 2, 4)
            .toFormatter();
    }
    return cOffsetFormatter;
}
 
Example 7
Source Project: coming   Source File: Cardumen_00189_t.java    License: MIT License 5 votes vote down vote up
/**
 * Gets a printer/parser for managing the offset id formatting.
 * 
 * @return the formatter
 */
private static synchronized DateTimeFormatter offsetFormatter() {
    if (cOffsetFormatter == null) {
        cOffsetFormatter = new DateTimeFormatterBuilder()
            .appendTimeZoneOffset(null, true, 2, 4)
            .toFormatter();
    }
    return cOffsetFormatter;
}
 
Example 8
Source Project: coming   Source File: Cardumen_00239_t.java    License: MIT License 5 votes vote down vote up
/**
 * Gets a printer/parser for managing the offset id formatting.
 * 
 * @return the formatter
 */
private static synchronized DateTimeFormatter offsetFormatter() {
    if (cOffsetFormatter == null) {
        cOffsetFormatter = new DateTimeFormatterBuilder()
            .appendTimeZoneOffset(null, true, 2, 4)
            .toFormatter();
    }
    return cOffsetFormatter;
}
 
Example 9
Source Project: coming   Source File: Cardumen_00239_s.java    License: MIT License 5 votes vote down vote up
/**
 * Gets a printer/parser for managing the offset id formatting.
 * 
 * @return the formatter
 */
private static synchronized DateTimeFormatter offsetFormatter() {
    if (cOffsetFormatter == null) {
        cOffsetFormatter = new DateTimeFormatterBuilder()
            .appendTimeZoneOffset(null, true, 2, 4)
            .toFormatter();
    }
    return cOffsetFormatter;
}
 
Example 10
Source Project: coming   Source File: Cardumen_0074_t.java    License: MIT License 5 votes vote down vote up
/**
 * Gets a printer/parser for managing the offset id formatting.
 * 
 * @return the formatter
 */
private static synchronized DateTimeFormatter offsetFormatter() {
    if (cOffsetFormatter == null) {
        cOffsetFormatter = new DateTimeFormatterBuilder()
            .appendTimeZoneOffset(null, true, 2, 4)
            .toFormatter();
    }
    return cOffsetFormatter;
}
 
Example 11
Source Project: coming   Source File: Cardumen_0074_s.java    License: MIT License 5 votes vote down vote up
/**
 * Gets a printer/parser for managing the offset id formatting.
 * 
 * @return the formatter
 */
private static synchronized DateTimeFormatter offsetFormatter() {
    if (cOffsetFormatter == null) {
        cOffsetFormatter = new DateTimeFormatterBuilder()
            .appendTimeZoneOffset(null, true, 2, 4)
            .toFormatter();
    }
    return cOffsetFormatter;
}
 
Example 12
Source Project: coming   Source File: Cardumen_00282_t.java    License: MIT License 5 votes vote down vote up
/**
 * Gets a printer/parser for managing the offset id formatting.
 * 
 * @return the formatter
 */
private static synchronized DateTimeFormatter offsetFormatter() {
    if (cOffsetFormatter == null) {
        cOffsetFormatter = new DateTimeFormatterBuilder()
            .appendTimeZoneOffset(null, true, 2, 4)
            .toFormatter();
    }
    return cOffsetFormatter;
}
 
Example 13
Source Project: coming   Source File: Cardumen_00282_s.java    License: MIT License 5 votes vote down vote up
/**
 * Gets a printer/parser for managing the offset id formatting.
 * 
 * @return the formatter
 */
private static synchronized DateTimeFormatter offsetFormatter() {
    if (cOffsetFormatter == null) {
        cOffsetFormatter = new DateTimeFormatterBuilder()
            .appendTimeZoneOffset(null, true, 2, 4)
            .toFormatter();
    }
    return cOffsetFormatter;
}
 
Example 14
Source Project: coming   Source File: Cardumen_0070_s.java    License: MIT License 5 votes vote down vote up
/**
 * Gets a printer/parser for managing the offset id formatting.
 * 
 * @return the formatter
 */
private static synchronized DateTimeFormatter offsetFormatter() {
    if (cOffsetFormatter == null) {
        cOffsetFormatter = new DateTimeFormatterBuilder()
            .appendTimeZoneOffset(null, true, 2, 4)
            .toFormatter();
    }
    return cOffsetFormatter;
}
 
Example 15
Source Project: coming   Source File: Cardumen_0070_t.java    License: MIT License 5 votes vote down vote up
/**
 * Gets a printer/parser for managing the offset id formatting.
 * 
 * @return the formatter
 */
private static synchronized DateTimeFormatter offsetFormatter() {
    if (cOffsetFormatter == null) {
        cOffsetFormatter = new DateTimeFormatterBuilder()
            .appendTimeZoneOffset(null, true, 2, 4)
            .toFormatter();
    }
    return cOffsetFormatter;
}
 
Example 16
Source Project: coming   Source File: Cardumen_00137_s.java    License: MIT License 5 votes vote down vote up
/**
 * Gets a printer/parser for managing the offset id formatting.
 * 
 * @return the formatter
 */
private static synchronized DateTimeFormatter offsetFormatter() {
    if (cOffsetFormatter == null) {
        cOffsetFormatter = new DateTimeFormatterBuilder()
            .appendTimeZoneOffset(null, true, 2, 4)
            .toFormatter();
    }
    return cOffsetFormatter;
}
 
Example 17
Source Project: coming   Source File: Cardumen_00137_t.java    License: MIT License 5 votes vote down vote up
/**
 * Gets a printer/parser for managing the offset id formatting.
 * 
 * @return the formatter
 */
private static synchronized DateTimeFormatter offsetFormatter() {
    if (cOffsetFormatter == null) {
        cOffsetFormatter = new DateTimeFormatterBuilder()
            .appendTimeZoneOffset(null, true, 2, 4)
            .toFormatter();
    }
    return cOffsetFormatter;
}
 
Example 18
Source Project: coming   Source File: Nopol2017_0089_t.java    License: MIT License 5 votes vote down vote up
/**
 * Gets a printer/parser for managing the offset id formatting.
 * 
 * @return the formatter
 */
private static synchronized DateTimeFormatter offsetFormatter() {
    if (cOffsetFormatter == null) {
        cOffsetFormatter = new DateTimeFormatterBuilder()
            .appendTimeZoneOffset(null, true, 2, 4)
            .toFormatter();
    }
    return cOffsetFormatter;
}
 
Example 19
Source Project: coming   Source File: Nopol2017_0089_s.java    License: MIT License 5 votes vote down vote up
/**
 * Gets a printer/parser for managing the offset id formatting.
 * 
 * @return the formatter
 */
private static synchronized DateTimeFormatter offsetFormatter() {
    if (cOffsetFormatter == null) {
        cOffsetFormatter = new DateTimeFormatterBuilder()
            .appendTimeZoneOffset(null, true, 2, 4)
            .toFormatter();
    }
    return cOffsetFormatter;
}
 
Example 20
Source Project: coming   Source File: Time_25_DateTimeZone_t.java    License: MIT License 5 votes vote down vote up
/**
 * Gets a printer/parser for managing the offset id formatting.
 * 
 * @return the formatter
 */
private static synchronized DateTimeFormatter offsetFormatter() {
    if (cOffsetFormatter == null) {
        cOffsetFormatter = new DateTimeFormatterBuilder()
            .appendTimeZoneOffset(null, true, 2, 4)
            .toFormatter();
    }
    return cOffsetFormatter;
}
 
Example 21
Source Project: coming   Source File: Time_25_DateTimeZone_s.java    License: MIT License 5 votes vote down vote up
/**
 * Gets a printer/parser for managing the offset id formatting.
 * 
 * @return the formatter
 */
private static synchronized DateTimeFormatter offsetFormatter() {
    if (cOffsetFormatter == null) {
        cOffsetFormatter = new DateTimeFormatterBuilder()
            .appendTimeZoneOffset(null, true, 2, 4)
            .toFormatter();
    }
    return cOffsetFormatter;
}
 
Example 22
Source Project: coming   Source File: Time_17_DateTimeZone_s.java    License: MIT License 5 votes vote down vote up
/**
 * Gets a printer/parser for managing the offset id formatting.
 * 
 * @return the formatter
 */
private static synchronized DateTimeFormatter offsetFormatter() {
    if (cOffsetFormatter == null) {
        cOffsetFormatter = new DateTimeFormatterBuilder()
            .appendTimeZoneOffset(null, true, 2, 4)
            .toFormatter();
    }
    return cOffsetFormatter;
}
 
Example 23
Source Project: coming   Source File: Time_17_DateTimeZone_t.java    License: MIT License 5 votes vote down vote up
/**
 * Gets a printer/parser for managing the offset id formatting.
 * 
 * @return the formatter
 */
private static synchronized DateTimeFormatter offsetFormatter() {
    if (cOffsetFormatter == null) {
        cOffsetFormatter = new DateTimeFormatterBuilder()
            .appendTimeZoneOffset(null, true, 2, 4)
            .toFormatter();
    }
    return cOffsetFormatter;
}
 
Example 24
Source Project: coming   Source File: Time_23_DateTimeZone_s.java    License: MIT License 5 votes vote down vote up
/**
 * Gets a printer/parser for managing the offset id formatting.
 * 
 * @return the formatter
 */
private static synchronized DateTimeFormatter offsetFormatter() {
    if (cOffsetFormatter == null) {
        cOffsetFormatter = new DateTimeFormatterBuilder()
            .appendTimeZoneOffset(null, true, 2, 4)
            .toFormatter();
    }
    return cOffsetFormatter;
}
 
Example 25
Source Project: coming   Source File: Time_23_DateTimeZone_t.java    License: MIT License 5 votes vote down vote up
/**
 * Gets a printer/parser for managing the offset id formatting.
 * 
 * @return the formatter
 */
private static synchronized DateTimeFormatter offsetFormatter() {
    if (cOffsetFormatter == null) {
        cOffsetFormatter = new DateTimeFormatterBuilder()
            .appendTimeZoneOffset(null, true, 2, 4)
            .toFormatter();
    }
    return cOffsetFormatter;
}
 
Example 26
Source Project: coming   Source File: Time_19_DateTimeZone_t.java    License: MIT License 5 votes vote down vote up
/**
 * Gets a printer/parser for managing the offset id formatting.
 * 
 * @return the formatter
 */
private static synchronized DateTimeFormatter offsetFormatter() {
    if (cOffsetFormatter == null) {
        cOffsetFormatter = new DateTimeFormatterBuilder()
            .appendTimeZoneOffset(null, true, 2, 4)
            .toFormatter();
    }
    return cOffsetFormatter;
}
 
Example 27
Source Project: coming   Source File: Time_19_DateTimeZone_s.java    License: MIT License 5 votes vote down vote up
/**
 * Gets a printer/parser for managing the offset id formatting.
 * 
 * @return the formatter
 */
private static synchronized DateTimeFormatter offsetFormatter() {
    if (cOffsetFormatter == null) {
        cOffsetFormatter = new DateTimeFormatterBuilder()
            .appendTimeZoneOffset(null, true, 2, 4)
            .toFormatter();
    }
    return cOffsetFormatter;
}
 
Example 28
Source Project: coming   Source File: Time_9_DateTimeZone_s.java    License: MIT License 5 votes vote down vote up
/**
 * Gets a printer/parser for managing the offset id formatting.
 * 
 * @return the formatter
 */
private static synchronized DateTimeFormatter offsetFormatter() {
    if (cOffsetFormatter == null) {
        cOffsetFormatter = new DateTimeFormatterBuilder()
            .appendTimeZoneOffset(null, true, 2, 4)
            .toFormatter();
    }
    return cOffsetFormatter;
}
 
Example 29
Source Project: coming   Source File: Time_9_DateTimeZone_t.java    License: MIT License 5 votes vote down vote up
/**
 * Gets a printer/parser for managing the offset id formatting.
 * 
 * @return the formatter
 */
private static synchronized DateTimeFormatter offsetFormatter() {
    if (cOffsetFormatter == null) {
        cOffsetFormatter = new DateTimeFormatterBuilder()
            .appendTimeZoneOffset(null, true, 2, 4)
            .toFormatter();
    }
    return cOffsetFormatter;
}
 
Example 30
Source Project: coming   Source File: Time_8_DateTimeZone_s.java    License: MIT License 5 votes vote down vote up
/**
 * Gets a printer/parser for managing the offset id formatting.
 * 
 * @return the formatter
 */
private static synchronized DateTimeFormatter offsetFormatter() {
    if (cOffsetFormatter == null) {
        cOffsetFormatter = new DateTimeFormatterBuilder()
            .appendTimeZoneOffset(null, true, 2, 4)
            .toFormatter();
    }
    return cOffsetFormatter;
}