實例代碼:
input = input.replace(/\-/g, "/");//橫杠的時間不能被識別,所以要替換程斜杠 let time = new Date(input); let year = time.getFullYear(); //年 let month = time.getMonth() + 1; //月 let day = time.getDate(); //日 return `${year}年${month}月${day}日`;
參考:
實例代碼:
input = input.replace(/\-/g, "/");//橫杠的時間不能被識別,所以要替換程斜杠 let time = new Date(input); let year = time.getFullYear(); //年 let month = time.getMonth() + 1; //月 let day = time.getDate(); //日 return `${year}年${month}月${day}日`;
參考:
本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。