Elementui日期选择器获取的时间字符串的格式转换

 <el-date-picker type="date" default-value='1990-1-1' placeholder="选择日期" v-model="birth" style="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();
原文地址:https://www.cnblogs.com/lyh233/p/14341946.html