Java
//拿到想要的String格式
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")
SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日hh时mm分ss秒SSS毫秒")
SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd/HH/mm/ss")
String dateString = sdf.format(new Date());
JS
var date = new Date().format("yyyy-MM-dd hh:mm:ss");
var oldDate = (new Date("2222/02/25 22:22:22")).getTime();
var date = oldDate.format("yyyy-MM-dd hh:mm:ss");