var unixtime=1358932051;formatTime (time) { let unixtime = time let unixTimestamp = new Date(unixtime * 1000) let Y = unixTimestamp.getFullYear() let M = ((unixTimestamp.getMonth() + 1) > 10 ? (unixTimestamp.getMonth() + 1) : '0' + (unixTimestamp.get
1.时间戳转换为标准日期时间格式: function timeFormat(dateStr) { var date = new Date(dateStr); Y = date.getFullYear() + '-'; M = (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1) : date.getMonth()+1) + '-'; D = date.getDate() + ' '; h = (date.getHours() < 10 ? '0'
/* *JS时间戳比较大小:对于一组时间戳(开始时间~结束时间)和另一组时间戳进行比较,用于判断被比较时间戳组是否在要求范围内 *@param date1 date2(形如:'2015-01-01'类型字符串) */ function compareDate(date1,date2){ //对获得的时间戳区间与既定的时间戳进行比对 var baseDate1='2015-01-01'; var baseDate2='2015-03-31'; baseDate1=new Date(baseDate