Tue Feb 01 2022 00:00:00 GMT+0800 (中国标准时间) 转化为 yyyy/MM/dd HH:mm:ss
<script>
/*获取当前年月*/
var now = new Date(); //当前日期
var nowMonth = now.getMonth(); //当前月
var nowYear = now.getFullYear(); //当前年
//下月的开始日期
var monthStartDate = new Date(nowYear, nowMonth + 1, 1);
/*日期格式化*/
function checkTime(i) {//时间
if (i < 10) {
i = "0" + i
}
return i;
}
var date = new Date(monthStartDate);
//下边为主要部分 date_value就是转化后的格式
date_value = date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate()
+ ' ' + checkTime(date.getHours()) + ':' + checkTime(date.getMinutes()) + ':' + checkTime(date.getSeconds());
</script>