这行 java 代码重复出现 "Date cannot be resosolved to a type" 错误

Repeatedly getting "Date cannot be resosolved to a type" errors for this line of java code

首先,我不是程序员,而是处理与银行、发票和类似任务相关的代码的外行(我是一名会计师)。

我正在尝试在 Java 中设置一个代码,用于根据国家网站上的说明计算法律要求打印在发票上的唯一编号序列。我正在通过 Eclipse 处理该项目。这是无论我尝试什么总是有两个错误的行:

String datVrij = new SimpleDateFormat( "22.09.2021 12:48:34" ).format( new Date() );

错误读取:

  1. 日期无法解析为类型
  2. SimpleDateFormat 无法解析为类型

我写错了吗?目前导入的东西只有这些:

import java.io.FileInputStream;

import java.security.Key;

import java.security.KeyStore;

import java.security.PrivateKey;

import java.security.Signature;

import org.apache.commons.codec.digest.DigestUtils;

非常感谢任何帮助,如果需要的话,我很乐意提供更多信息。

就像评论开始的那样,你可能没有导入 java.util.Datejava.text.SimpleDateFormat