public static OffsetDateTime parse(final String d) {
        final TemporalAccessor t = formatter.parse(d);

        if (!t.isSupported(ChronoField.HOUR_OF_DAY)) {
            // no hours field so it must be a Date or a YearMonth
            if (!t.isSupported(ChronoField.DAY_OF_MONTH)) {
                // must be a YearMonth coz no day
                return OffsetDateTime.of(LocalDate.of(Year.from(t).getValue(), Month.from(t), 1), LocalTime.MIDNIGHT, UTC);
            } else {
                // must be a Date as the day is present
                return OffsetDateTime.of(LocalDate.from(t), LocalTime.MIDNIGHT, UTC);
            }
        } else if (!t.isSupported(ChronoField.MONTH_OF_YEAR)) {
            // no month field so must be a Time
            return OffsetDateTime.of(LocalDate.ofEpochDay(0), LocalTime.from(t), UTC);
        } else {
            // can directly obtain from TemporalAccessor
            return OffsetDateTime.from(t);
        }
    }
Parses a {@code String} representing a date and/or time to a {@code Date} object with a default time zone offset
of UTC (+00:00). It can parse dates in any of the following formats.

<ul>
    <li>2018-03-22</li>
    <li>2018-03-22T00:35:44</li>
    <li>2018-03-22T00:35:44Z</li>
    <li>2018-03-22T00:35:44.741</li>
    <li>2018-03-22T00:35:44.741Z</li>
    <li>2018-03-22T00:35:44.741+1600</li>
    <li>2018-03-22T00:35:44.741+16:00</li>
    <li>2018-03-22T00:35:44.741+160000</li>
    <li>2018-03-22T00:35:44.741+16:00:00</li>
</ul>>
gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/util/DatetimeHelper.java