code: private static long fileCreationTime(File targetFile)
    {
      if (!targetFile.exists())
      {
        LOGGER.debug("File not exists. File: {}", targetFile);
        return -1;
      }
      try
      {
        Path cacheFileLockPath = Paths.get(targetFile.getAbsolutePath());
        BasicFileAttributes attr = Files.readAttributes(
            cacheFileLockPath, BasicFileAttributes.class);
        return attr.creationTime().toMillis();
      }
      catch (IOException ex)
      {
        LOGGER.debug(
            "Failed to get creation time. File/Dir: {}, Err: {}",
            targetFile, ex);
      }
      return -1;
    }
docs: Gets file/dir creation time in epoch (ms)
  
  @return epoch time in ms