Calendar nowBefore = Calendar.getInstance();
Calendar nowAfter = Calendar.getInstance();
nowBefore.add(Calendar.MINUTE, 30);
nowAfter.add(Calendar.MINUTE, -30);
SimpleDateFormat sdf= new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
System.out.println( sdf.format(nowBefore.getTimeInMillis()) );
System.out.println( sdf.format(nowAfter.getTimeInMillis()) );
Java 取得 30 分钟前的时间 字符串格式
最新推荐文章于 2024-06-29 03:01:56 发布