private static Date getCreationTime(GoogleMediaItem mediaItem) throws ParseException {
    // per verified backend code, this cannot be empty or null
    final String zonedIso8601DateTime = mediaItem.getMediaMetadata().getCreationTime();

    try {
      // per https://developers.google.com/photos/library/reference/rest/v1/mediaItems#mediametadata
      // we expect an iso 8601 date-time with a timezone/offset indicator.
      return parseIso8601DateTime(zonedIso8601DateTime);
    } catch (ParseException parseException) {
      throw new ParseException(
          String.format(
              "Failed parsing creation time from \"%s\" for MediaItem %s",
              mediaItem.getMediaMetadata().getCreationTime(), mediaItem.getId()),
          parseException.getErrorOffset());
    }
  }
Nearly identical variant of {@link Instant#parse} that, per RFC3339, is okay with either
offsets or "Z" indicator.
extensions/data-transfer/portability-data-transfer-google/src/main/java/org/datatransferproject/datatransfer/google/mediaModels/GoogleMediaItem.java