public voidgetNextTime(){
Date date = new Date();
Calendar c = Calendar.getInstance();
c.setTime(date);
// c.add(Calendar.SECOND, -1);//前一秒
c.add(Calendar.SECOND, 1);//后一秒
SimpleDateFormat sdf =new SimpleDateFormat("yyyy-MM-dd HH:mm:ss" );
String strTime = sdf.format(c.getTime());
System.out.println(strTime);
}
java 获取前/后一秒时间
最新推荐文章于 2024-07-08 03:00:10 发布