原文链接:https://blog.csdn.net/qq_41176306/article/details/116130423
// Date --> JulianDate
let t = new Date();
console.log(t);// Sun Apr 25 2021 15:11:01 GMT+0800 (中国标准时间)
let julian_t = Cesium.JulianDate.fromDate(t);
console.log(julian_t);// JulianDate {dayNumber: 2459329, secondsOfDay: 69098.341}
// JulianDate --> Date
let jsDate = new Date(julian_t.toString())
console.log(jsDate);// Sun Apr 25 2021 15:23:09 GMT+0800 (中国标准时间)
// TZ时间格式
let tzTime = julian_t.toString();
console.log(tzTime);// 2021-04-25T07:21:14.20799999999871943Z
// YYY-mm-ss hh:mm:ss
tzTime = tzTime.replace(/T/, ' ').replace(/Z/, '').replace(/\.\d+/g, '');
console.log(tzTime);// 2021-04-25 07:21:14
网友评论