jquery字符串转日期

jquery字符串转日期

$(function() {
			//字符串转日期格式,strDate要转为日期格式的字符串
			function getDate(strDate) {
				var date = eval('new Date(' + strDate.replace(/\d+(?=-[^-]+$)/,
					function(a) {
						return parseInt(a, 10) - 1;
					}).match(/\d+/g) + ')');
				console.log(date);
			}
			getDate("1902-02-13");
		})

猜你喜欢

转载自blog.csdn.net/weixin_40687883/article/details/80431391
今日推荐