Home > Back-end >  Java. SQL. Timestamp addition how to do?
Java. SQL. Timestamp addition how to do?

Time:01-04

An object such as Java, SQL Timestamp type date plus or minus one day, a day online for a long time didn't find the right,

CodePudding user response:

 
Timestamp currentTime=new Timestamp (System. CurrentTimeMillis ());
1 day//here is 24 * 3600 * 1000, 2 days is 2 * * 3600 * 1000, 24 so on
Timestamp secondDay=new Timestamp (currentTime getTime () + (24 * 3600 * 1000));
  • Related