标准时间对象的转换

标准时间格式

Wed Jul 02 1975 00:00:00 GMT+0800

把这个时间格式转化为我们常见的时间

  const d=new Date(date);

把标准时间格式转化为我们常见的时间格式

dateChange(date){
   console.log(date)
   const d=new Date(date);
   console.log(d)
   this.user.birth=`${d.getFullYear()}-${d.getMonth()+1}-${d.getDate()}`
   this.user.age=new Date().getFullYear()-d.getFullYear()
},

猜你喜欢

转载自www.cnblogs.com/mrxinxin/p/10244433.html
今日推荐