new Date().toJSON().substring(0,19).replace(/-/gm,‘‘).replace(/:/gm,‘‘)
结果:
"20150801T125030"
Java获取当前时间传给前端:
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd-HH:mm:ss");
String date = dateFormat.format(new java.util.Date());
date = date.replace("-", "T");
date = date.replaceAll(":", "");
结果:
20150801T215305
时间: 2024-10-07 07:26:17