N
N
NikaNY2018-10-16 15:55:06
Java
NikaNY, 2018-10-16 15:55:06

Insert datetime(java) to DB via NetBeans doesn't update time until you rebuild project?

NetBeans+Spring+java+mssql We
insert values ​​from the form, as well as the current date and time we write to the database

java.util.Date Date = new java.util.Date();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String date2 = sdf.format(Date);

However, the time is recorded fixed, i.e. for example:
1. Collected the project (NetBeans)
2. Filled out the form data and sent these values ​​to the database (the time is written automatically up-to-date, the format of the datetime column in the database) is valid at 14:54
3. Subsequent form fillings with other natural values ​​​​(with clearing the cache , cookies) are written to the database with the same time (14:54)
4. But it's worth "cleaning and building" the project or "execute" and start doing step 2. so the time will be recorded in the database, already relevant at the time of recording after rebuilding the project
5bc5df49e9db3086994113.jpegWhere to dig, tell me please!
ps Project ( NetBeans) local, db remote

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
NikaNY, 2018-10-17
@NikaNY

I found an error ... I put this piece before processRequest, but it was necessary in processRequest to initialize a new date each time ..

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question