SOURCE

// 格林威治时间和本地时间之间的时差 (单位:毫秒)
const offset = new Date().getTimezoneOffset() * 60 * 1000;

/**
*	 零时区 -> 本地时间	
**/
function getLocalTime(date){
  return formatDate(new Date(date) + offset, 'yyyy-MM-d hh:mm:ss');
}

/**
*  格式化时间
**/
function formatDate(date, fmt) {
  const o = {
    'M+': date.getMonth() + 1,
    'd+': date.getDate(),
    'h+': date.getHours(),
    'm+': date.getMinutes(),
    's+': date.getSeconds(),
    'q+': Math.floor((date.getMonth() + 3) / 3),
    'S': date.getMilliseconds()
  }
  if (/(y+)/.test(fmt)) {
    fmt = fmt.replace(RegExp.$1, (date.getFullYear() + '').substr(4 - RegExp.$1.length))
  }
  for (const k in o) {
    if (new RegExp('(' + k + ')').test(fmt)) {
      fmt = fmt.replace(RegExp.$1, (RegExp.$1.length === 1) ? (o[k]) : (('00' + o[k]).substr(('' + o[k]).length)))
    }
  }
  return fmt
}

console.log(getLocalTime(new Date("2018/12/12"), 'yyyy-MM-d hh:mm:ss'))
console 命令行工具 X clear

                    
>
console