php 后台传回前端日期字符串抓换成时间对象

时间:2021-08-18 15:45:37   收藏:0   阅读:24
老的js 页面                     
$.post(‘{:U("getNowTimeFormat")}‘, function(data){
                        let json = JSON.parse(data); 
                        let s = json.formatDate;
                        s = s.replace(/-/g,"/");
                        let date = new Date(s).getTime();
                    });
 
新的页面可以直接干
                    axios.get("{:U(‘getNowTimeFormat‘)}")
                        .then(response => {
                            let nowTime = new Date(response.data.formatDate).getTime()
                        })

原文:https://www.cnblogs.com/quepq/p/15156021.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!