code: @Override
    public TimestampedDatasetVersion getDatasetVersion(Path pathRelativeToDatasetRoot, FileStatus versionFileStatus) {
  
      String dateTimeString = null;
      try {
        // pathRelativeToDatasetRoot can be daily/2016/03/02 or 2016/03/02. In either case we need to pick 2016/03/02 as version
        dateTimeString =
            StringUtils.substring(pathRelativeToDatasetRoot.toString(), pathRelativeToDatasetRoot.toString().length()
                - this.datePartitionPattern.length());
  
        return new FileStatusTimestampedDatasetVersion(this.formatter.parseDateTime(dateTimeString), versionFileStatus);
  
      } catch (IllegalArgumentException exception) {
        LOGGER.warn(String.format(
            "Candidate dataset version with pathRelativeToDatasetRoot: %s has inferred dataTimeString:%s. "
                + "It does not match expected datetime pattern %s. Ignoring.", pathRelativeToDatasetRoot, dateTimeString,
            this.datePartitionPattern));
        return null;
      }
    }
docs: Parse {@link org.joda.time.DateTime} from {@link org.apache.hadoop.fs.Path} using datetime pattern.