import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Timer;
import java.util.TimerTask;
public clas TimerTest{
public static void timerTest(String[] args) {
Timer timer = new Timer(false);
Date firstTime =new Date();
long period=1000 * 1;
timer.schedule(new TimerTask(){
@Override
public void run() {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String nowTime = sdf.format(new Date());
System.out.println(nowTime + ":成功完成了一次数据备份!");
}
} , firstTime, period);
}
}