js计算每个月的总天数

mac2022-06-30  68

    js中相关日期的计算

    

var year = new Date().getFullYear(),//计算当前年份 month = new Date().getMonth()+1,//计算当前月份 dates = new Date().getDate(),//计算当前日期 week = new Date().getDay(),//计算当前前是周几 hours = new Date().getHours(),//计算当前的是几点 minutes = new Date().getMinutes(), seconds = new Date().getSeconds(), currentTime = new Date().getTime(),//得到当前时间的毫秒数 dayCount = new Date(year,month,0).getDate(),//计算当前月一共有几天 localTime = new Date().toLocaleString();//获得当地时间 function formatTime(time){//time是传入的毫秒数 let dates = new Date(time) return (dates.getFullYear())+'-'+(dates.getMonth()+1)+'-'+dates.getDate() }

项目中常用的日期格式化及计算

转载于:https://www.cnblogs.com/bllx/p/10542127.html

相关资源:js 得到某个月份的天数
最新回复(0)