js/jq进行日期格式化为:yyyy-MM-dd 如2017-05-08

设置日期为yyyy-MM-dd,代码如下:


function setDefaultDate() {

				var mydate = new Date();

				var month = myDate.getMonth() + 1;

				var day = myDate.getDate();

				month = (month.toString().length == 1) ? ("0" + month) : month;

				day = (day.toString().length == 1) ? ("0" + day) : day;

 

				var result = myDate.getFullYear() + '-' + month + '-' + day; //当前日期

 

				return result;

			}

转载自 https://blog.csdn.net/baidu_37107022/article/details/78450127

 

你可能感兴趣的:(js,django)