java日期格式化成年月日时分秒(“yyyy-MM-dd-hh:mm:ss”) SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd-hh:mm:ss"); Date date = new Date(); String format = simpleDateFormat.format(date); System.out.println(format); 输出:2022-04-21-11:38:59