js代码,中国标准时间转换为yyyy-MM-dd

'Thu May 12 2016 08:00:00 GMT+0800 (中国标准时间)'--此格式日期无法传到java后台,须格式化,方法如下

var d = new Date('Thu May 12 2016 08:00:00 GMT+0800 (中国标准时间)');
var datetime=d.getFullYear() + '-' + (d.getMonth() + 1) + '-' + d.getDate() + ' ' + d.getHours() + ':' + d.getMinutes() + ':' + d.getSeconds();

参考文档:

https://www.cnblogs.com/gudi/p/8031219.html

表示感谢!!

猜你喜欢

转载自blog.csdn.net/guanmao4322/article/details/82257755
今日推荐