zl程序教程

您现在的位置是:首页 >  后端

当前栏目

java 获得系统当前时间详解编程语言

JAVA系统编程语言 详解 时间 当前 获得
2023-06-13 09:11:49 时间
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Calendar c = new GregorianCalendar(); Date date = new Date(); System.out.println("系统当前时间"+df.format(date)); //设置参数时间 c.setTime(date); //SECOND 秒 整数增加,负数减少 c.add(Calendar.SECOND,-10); System.out.println("系统前10秒时间:"+df.format(c.getTime())); //DAY_OF_MONTH 天 整数增加,负数减少 c.add(Calendar.DAY_OF_MONTH,1); System.out.println("系统前1天时间:"+df.format(c.getTime())); }

18538.html

cgojava