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

Time:09-23

First of all, I'm not a programmer, but a layman working with codes insofar as they relate to banking, invoicing, and similar tasks (I work as an accountant).

I am trying to set up a code in Java meant to calculate a unique number sequence legally required to be printed on invoices, according to instructions on state websites. I am working on the project through Eclipse. This is the line which always has two errors no matter what I try:

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

The errors read:

  1. Date cannot be resolved to a type
  2. SimpleDateFormat cannot be resolved to a type

Have I written something wrong? The things imported so far are only these:

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;

Any help is greatly appreciated, and I will gladly provide more information if that's what's needed.

CodePudding user response:

Like the comments stated, you probably didnt import java.util.Date and java.text.SimpleDateFormat

  • Related