var timestamp =1539598555000;//时间戳 //时间戳转换成time格式function timestampToTime(timestamp) { var date = new Date(timestamp );//时间戳为10位需*1000,时间戳为13位的话不需乘1000 Y = date.getFullYear() + '-'; M = (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1) : date.getMont
1. datetime转换成timestamp strdate = "2015-08-09 08:01:36:"; var d = new Date(strdate); var timestamp=Math.round(d.getTime()); document.write("timestamp: "+timestamp+"<br>"); 输出: timestamp: 1439078496789 其它方法: var timesta
// 获得的后台json 时间格式转化 例如:1520305366000 转化为XXXX-XX-XX类似这种 function timeStamp2String(time){ var datetime = new Date(); datetime.setTime(time); var year = datetime.getFullYear(); var month = datetime.getMonth() + 1 < 10 ? "0" + (datetime.getMonth
//obtain timestamp of last week var now=new Date() var nowDayOfWeek = now.getDay(); //今天本周的第几天 var nowDay = now.getDate(); //当前日 var nowMonth = now.getMonth(); //当前月 var nowYear = now.getFullYear(); //当前年 //obtain time of last month var lastMonthDate