Elementui日期選擇器獲取的時間字符串的格式轉換


 <el-date-picker type="date" default-value='1990-1-1' placeholder="選擇日期" v-model="birth" style="width:100%"></el-date-picker>

vue中真正獲取后的birth的值的格式為:Thu May 12 2016 08:00:00 GMT+0800 (中國標准時間)

獲取自己想要的格式:

birthStr=birth.getFullYear() + '-' + (birth.getMonth() + 1) + '-' + birth.getDate() + ' ' + birth.getHours() + ':' + birth.getMinutes() + ':' + birth.getSeconds();

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM