// timestamp format, toJSON turn is GMT +8 hours GMT
function dateTime(time = +new Date()) { var date = new Date(time + 8 * 3600 * 1000); return date.toJSON().substr(0, 19).replace('T', ' ').replace(/-/g, '.'); }
Content from: https://segmentfault.com/a/1190000015992232
added if the parameter is 10 digits or ten digits of the string can use the following code
function dateTime(time) { time = time+'000' var date = new Date(parseInt(time) + 8 * 3600 * 1000); return date.toJSON().substr(0, 19).replace('T', ' ').replace(/-/g, '.'); }