Java Code Examples for org.threeten.bp.OffsetDateTime#parse()

The following examples show how to use org.threeten.bp.OffsetDateTime#parse() . 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: JSON.java    From huaweicloud-cs-sdk with Apache License 2.0 5 votes vote down vote up
@Override
public OffsetDateTime read(JsonReader in) throws IOException {
    switch (in.peek()) {
        case NULL:
            in.nextNull();
            return null;
        default:
            String date = in.nextString();
            if (date.endsWith("+0000")) {
                date = date.substring(0, date.length()-5) + "Z";
            }
            return OffsetDateTime.parse(date, formatter);
    }
}
 
Example 2
Source File: JSON.java    From huaweicloud-cs-sdk with Apache License 2.0 5 votes vote down vote up
@Override
public OffsetDateTime read(JsonReader in) throws IOException {
    switch (in.peek()) {
        case NULL:
            in.nextNull();
            return null;
        default:
            String date = in.nextString();
            if (date.endsWith("+0000")) {
                date = date.substring(0, date.length()-5) + "Z";
            }
            return OffsetDateTime.parse(date, formatter);
    }
}
 
Example 3
Source File: JSON.java    From openapi-generator with Apache License 2.0 5 votes vote down vote up
@Override
public OffsetDateTime read(JsonReader in) throws IOException {
    switch (in.peek()) {
        case NULL:
            in.nextNull();
            return null;
        default:
            String date = in.nextString();
            if (date.endsWith("+0000")) {
                date = date.substring(0, date.length()-5) + "Z";
            }
            return OffsetDateTime.parse(date, formatter);
    }
}
 
Example 4
Source File: JSON.java    From openapi-generator with Apache License 2.0 5 votes vote down vote up
@Override
public OffsetDateTime read(JsonReader in) throws IOException {
    switch (in.peek()) {
        case NULL:
            in.nextNull();
            return null;
        default:
            String date = in.nextString();
            if (date.endsWith("+0000")) {
                date = date.substring(0, date.length()-5) + "Z";
            }
            return OffsetDateTime.parse(date, formatter);
    }
}
 
Example 5
Source File: JSON.java    From openapi-generator with Apache License 2.0 5 votes vote down vote up
@Override
public OffsetDateTime read(JsonReader in) throws IOException {
    switch (in.peek()) {
        case NULL:
            in.nextNull();
            return null;
        default:
            String date = in.nextString();
            if (date.endsWith("+0000")) {
                date = date.substring(0, date.length()-5) + "Z";
            }
            return OffsetDateTime.parse(date, formatter);
    }
}
 
Example 6
Source File: JSON.java    From openapi-generator with Apache License 2.0 5 votes vote down vote up
@Override
public OffsetDateTime read(JsonReader in) throws IOException {
    switch (in.peek()) {
        case NULL:
            in.nextNull();
            return null;
        default:
            String date = in.nextString();
            if (date.endsWith("+0000")) {
                date = date.substring(0, date.length()-5) + "Z";
            }
            return OffsetDateTime.parse(date, formatter);
    }
}
 
Example 7
Source File: JSON.java    From openapi-generator with Apache License 2.0 5 votes vote down vote up
@Override
public OffsetDateTime read(JsonReader in) throws IOException {
    switch (in.peek()) {
        case NULL:
            in.nextNull();
            return null;
        default:
            String date = in.nextString();
            if (date.endsWith("+0000")) {
                date = date.substring(0, date.length()-5) + "Z";
            }
            return OffsetDateTime.parse(date, formatter);
    }
}
 
Example 8
Source File: JSON.java    From openapi-generator with Apache License 2.0 5 votes vote down vote up
@Override
public OffsetDateTime read(JsonReader in) throws IOException {
    switch (in.peek()) {
        case NULL:
            in.nextNull();
            return null;
        default:
            String date = in.nextString();
            if (date.endsWith("+0000")) {
                date = date.substring(0, date.length()-5) + "Z";
            }
            return OffsetDateTime.parse(date, formatter);
    }
}
 
Example 9
Source File: JSON.java    From android with MIT License 5 votes vote down vote up
@Override
public OffsetDateTime read(JsonReader in) throws IOException {
    switch (in.peek()) {
        case NULL:
            in.nextNull();
            return null;
        default:
            String date = in.nextString();
            if (date.endsWith("+0000")) {
                date = date.substring(0, date.length()-5) + "Z";
            }
            return OffsetDateTime.parse(date, formatter);
    }
}
 
Example 10
Source File: JSON.java    From nifi-swagger-client with Apache License 2.0 5 votes vote down vote up
@Override
public OffsetDateTime read(JsonReader in) throws IOException {
    switch (in.peek()) {
        case NULL:
            in.nextNull();
            return null;
        default:
            String date = in.nextString();
            if (date.endsWith("+0000")) {
                date = date.substring(0, date.length()-5) + "Z";
            }
            return OffsetDateTime.parse(date, formatter);
    }
}
 
Example 11
Source File: JSON.java    From swaggy-jenkins with MIT License 5 votes vote down vote up
@Override
public OffsetDateTime read(JsonReader in) throws IOException {
    switch (in.peek()) {
        case NULL:
            in.nextNull();
            return null;
        default:
            String date = in.nextString();
            if (date.endsWith("+0000")) {
                date = date.substring(0, date.length()-5) + "Z";
            }
            return OffsetDateTime.parse(date, formatter);
    }
}
 
Example 12
Source File: JSON.java    From swagger-aem with Apache License 2.0 5 votes vote down vote up
@Override
public OffsetDateTime read(JsonReader in) throws IOException {
    switch (in.peek()) {
        case NULL:
            in.nextNull();
            return null;
        default:
            String date = in.nextString();
            if (date.endsWith("+0000")) {
                date = date.substring(0, date.length()-5) + "Z";
            }
            return OffsetDateTime.parse(date, formatter);
    }
}
 
Example 13
Source File: OffsetDateTimeConverterTest.java    From ThreeTen-Backport-Gson-Adapter with Apache License 2.0 5 votes vote down vote up
@Test
public void testSerialization() {
    OffsetDateTime offsetDateTime = OffsetDateTime.parse("2010-08-20T10:37:50+08:00");

    String json = gson.toJson(offsetDateTime);

    assertEquals(json, "\"2010-08-20T10:37:50+08:00\"");
}
 
Example 14
Source File: JSON.java    From oxd with Apache License 2.0 5 votes vote down vote up
@Override
public OffsetDateTime read(JsonReader in) throws IOException {
    switch (in.peek()) {
        case NULL:
            in.nextNull();
            return null;
        default:
            String date = in.nextString();
            if (date.endsWith("+0000")) {
                date = date.substring(0, date.length()-5) + "Z";
            }
            return OffsetDateTime.parse(date, formatter);
    }
}
 
Example 15
Source File: BrapiObservation.java    From Field-Book with GNU General Public License v2.0 5 votes vote down vote up
private OffsetDateTime convertTime(String time) {
    OffsetDateTime converted = null;
    try {
        //TODO: locale
        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSSXXX");
        converted = OffsetDateTime.parse(time, formatter);
    } catch (DateTimeParseException e) {
        e.printStackTrace();
    } finally {
        return converted;
    }

}