js 时间格式字符串转时间搓格式

话不多说 直接上代码

get_unix_time(dateStr) {
    
    
  var newstr = dateStr.replace(/-/g, '/');
     var date = new Date(newstr);
     var time_str = date.getTime().toString();
     return time_str.substr(0, 10);
}
this.get_unix_time('2022-05-04');

猜你喜欢

转载自blog.csdn.net/weixin_45966674/article/details/124573866