时间转为时间戳 timeToTimestamp(time){ let timestamp = Date.parse(time) return timestamp; } 时间戳转为本地时间 timestampToTime(timestamp){ let date = new Date(timestamp); var YY = date.getFullYear() + '-'; var MM = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() +…
1.将时间戳转换成时间 var formatDate = function(d) { var now = new Date(d); var year = now.getFullYear(); var month = now.getMonth() + 1; var date = now.getDate(); var hour = now.getHours(); var minute = now.getMinutes(); var second = now.getSeconds(); return…
<script type="text/javascript"> var time = "2015-04-22 21:41:43";//2015-4-22 21:41:43 var temp = time.split(' '); var arr = temp[0].split('-'); var brr = temp[1].split(':'); var timestamp = new Date(Date.UTC(arr[0],arr[1]-1,arr[2…