Java Code Examples for java.time.format.DateTimeFormatter#ISO_ZONED_DATE_TIME

The following examples show how to use java.time.format.DateTimeFormatter#ISO_ZONED_DATE_TIME . 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
Source File: PutSQL.java    From localization_nifi with Apache License 2.0 6 votes vote down vote up
private DateTimeFormatter getDateTimeFormatter(String pattern) {
    switch(pattern) {
        case "BASIC_ISO_DATE": return DateTimeFormatter.BASIC_ISO_DATE;
        case "ISO_LOCAL_DATE": return DateTimeFormatter.ISO_LOCAL_DATE;
        case "ISO_OFFSET_DATE": return DateTimeFormatter.ISO_OFFSET_DATE;
        case "ISO_DATE": return DateTimeFormatter.ISO_DATE;
        case "ISO_LOCAL_TIME": return DateTimeFormatter.ISO_LOCAL_TIME;
        case "ISO_OFFSET_TIME": return DateTimeFormatter.ISO_OFFSET_TIME;
        case "ISO_TIME": return DateTimeFormatter.ISO_TIME;
        case "ISO_LOCAL_DATE_TIME": return DateTimeFormatter.ISO_LOCAL_DATE_TIME;
        case "ISO_OFFSET_DATE_TIME": return DateTimeFormatter.ISO_OFFSET_DATE_TIME;
        case "ISO_ZONED_DATE_TIME": return DateTimeFormatter.ISO_ZONED_DATE_TIME;
        case "ISO_DATE_TIME": return DateTimeFormatter.ISO_DATE_TIME;
        case "ISO_ORDINAL_DATE": return DateTimeFormatter.ISO_ORDINAL_DATE;
        case "ISO_WEEK_DATE": return DateTimeFormatter.ISO_WEEK_DATE;
        case "ISO_INSTANT": return DateTimeFormatter.ISO_INSTANT;
        case "RFC_1123_DATE_TIME": return DateTimeFormatter.RFC_1123_DATE_TIME;
        default: return DateTimeFormatter.ofPattern(pattern);
    }
}
 
Example 2
Source File: JdbcCommon.java    From nifi with Apache License 2.0 6 votes vote down vote up
public static DateTimeFormatter getDateTimeFormatter(String pattern) {
    switch(pattern) {
        case "BASIC_ISO_DATE": return DateTimeFormatter.BASIC_ISO_DATE;
        case "ISO_LOCAL_DATE": return DateTimeFormatter.ISO_LOCAL_DATE;
        case "ISO_OFFSET_DATE": return DateTimeFormatter.ISO_OFFSET_DATE;
        case "ISO_DATE": return DateTimeFormatter.ISO_DATE;
        case "ISO_LOCAL_TIME": return DateTimeFormatter.ISO_LOCAL_TIME;
        case "ISO_OFFSET_TIME": return DateTimeFormatter.ISO_OFFSET_TIME;
        case "ISO_TIME": return DateTimeFormatter.ISO_TIME;
        case "ISO_LOCAL_DATE_TIME": return DateTimeFormatter.ISO_LOCAL_DATE_TIME;
        case "ISO_OFFSET_DATE_TIME": return DateTimeFormatter.ISO_OFFSET_DATE_TIME;
        case "ISO_ZONED_DATE_TIME": return DateTimeFormatter.ISO_ZONED_DATE_TIME;
        case "ISO_DATE_TIME": return DateTimeFormatter.ISO_DATE_TIME;
        case "ISO_ORDINAL_DATE": return DateTimeFormatter.ISO_ORDINAL_DATE;
        case "ISO_WEEK_DATE": return DateTimeFormatter.ISO_WEEK_DATE;
        case "ISO_INSTANT": return DateTimeFormatter.ISO_INSTANT;
        case "RFC_1123_DATE_TIME": return DateTimeFormatter.RFC_1123_DATE_TIME;
        default: return DateTimeFormatter.ofPattern(pattern);
    }
}
 
Example 3
Source File: TimeSeriesManagerTest.java    From ta4j-origins with MIT License 6 votes vote down vote up
@Before
public void setUp() {

    final DateTimeFormatter dtf = DateTimeFormatter.ISO_ZONED_DATE_TIME;
    seriesForRun = new MockTimeSeries(
            new double[] { 1d, 2d, 3d, 4d, 5d, 6d, 7d, 8d, 9d },
            new ZonedDateTime[] {
                ZonedDateTime.parse("2013-01-01T00:00:00-05:00", dtf),
                ZonedDateTime.parse("2013-08-01T00:00:00-05:00", dtf),
                ZonedDateTime.parse("2013-10-01T00:00:00-05:00", dtf),
                ZonedDateTime.parse("2013-12-01T00:00:00-05:00", dtf),
                ZonedDateTime.parse("2014-02-01T00:00:00-05:00", dtf),
                ZonedDateTime.parse("2015-01-01T00:00:00-05:00", dtf),
                ZonedDateTime.parse("2015-08-01T00:00:00-05:00", dtf),
                ZonedDateTime.parse("2015-10-01T00:00:00-05:00", dtf),
                ZonedDateTime.parse("2015-12-01T00:00:00-05:00", dtf)
            });
    manager = new TimeSeriesManager(seriesForRun);

    strategy = new BaseStrategy(new FixedRule(0, 2, 3, 6), new FixedRule(1, 4, 7, 8));
    strategy.setUnstablePeriod(2); // Strategy would need a real test class
}
 
Example 4
Source File: TCKDTFParsedInstant.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@Test(dataProvider="parseWithZoneWithOffset")
public void testWithZoneWithOffset(String zdtString, LocalDateTime ldt, ZoneOffset offset, ZoneId zone) {
    dtFormatter = DateTimeFormatter.ISO_ZONED_DATE_TIME;
    zdt1 = ZonedDateTime.ofInstant(ldt, offset, zone);
    zdt2 = ZonedDateTime.parse(zdtString, dtFormatter);
    assertEquals(zdt1, zdt2);
}
 
Example 5
Source File: TCKDTFParsedInstant.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
@BeforeMethod
public void setUp() throws Exception {
    dtFormatter = DateTimeFormatter.ISO_ZONED_DATE_TIME;
}
 
Example 6
Source File: ZonedDateTimeXmlAdapter.java    From threeten-jaxb with Apache License 2.0 4 votes vote down vote up
public ZonedDateTimeXmlAdapter() {
    super(DateTimeFormatter.ISO_ZONED_DATE_TIME, ZonedDateTime::from);
}
 
Example 7
Source File: ParseZonedDateTimeTest.java    From super-csv with Apache License 2.0 4 votes vote down vote up
@Test
public void testConstructor4WithNullNext() {
	exception.expect(NullPointerException.class);
	new ParseZonedDateTime(DateTimeFormatter.ISO_ZONED_DATE_TIME, null);
}
 
Example 8
Source File: JavaTimeTypesParamConverterProvider.java    From cxf with Apache License 2.0 4 votes vote down vote up
protected DateTimeFormatter getFormatter() {
    return DateTimeFormatter.ISO_ZONED_DATE_TIME;
}