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