JS将"2019-4-28"转成"2019年4月28日"
代码实现:=>
//split将‘-’变成‘,’,并且成为数组
let str = '2019-4-28'; let year = str.split('-')[0]; let month = str.split('-')[1]; let date = str.split('-')[2]; let str1 =year+"年"+month+"月"+date+"日"; console.log(str1);
代码实现:=>
//split将‘-’变成‘,’,并且成为数组
let str = '2019-4-28'; let year = str.split('-')[0]; let month = str.split('-')[1]; let date = str.split('-')[2]; let str1 =year+"年"+month+"月"+date+"日"; console.log(str1);