![](https://img-blog.csdnimg.cn/90a138666a0c4675a9c1fd8ed102bb61.png)
package Java_project_1;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
public class Test{
public static void main(String[] args) throws ParseException {
String dataStr="2021年08月06日 11:11:11";
SimpleDateFormat sdf=new SimpleDateFormat("yyyy年MM月dd日 HH:mm:ss");
Date d=sdf.parse(dataStr);
long time=d.getTime()+(2L*24*60*60+14*60*60+49*60+6)*1000;
System.out.println(sdf.format(time));
}
}
![](https://img-blog.csdnimg.cn/38414f9e75c945eab09233e5c132a35f.png)
package Java_project_1;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
public class Test{
public static void main(String[] args) throws ParseException {
String startTime="2021-11-11 00:00:00";
String endTime="2021-11-11 00:10:00";
String xiaoJia="2021-11-11 00:03:47";
String xiaoPi="2021-11-11 00:10:11";
SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date d1=sdf.parse(startTime);
Date d2=sdf.parse(endTime);
Date d3=sdf.parse(xiaoJia);
Date d4=sdf.parse(xiaoPi);
if (d3.after(d1)&&d3.before(d2)){
System.out.println("小佳秒杀成功");
}else {
System.out.println("小佳秒杀失败");
}
if (d4.after(d1)&& d4.before(d1)){
System.out.println("小皮秒杀成功");
}else {
System.out.println("小皮秒杀失败");
}
}
}