使用systemDateTime.getTime(),可以参考文档:https://developer.huawei.com/consumer/cn/doc/harmonyos-references-V5/js-apis-date-time-V5\#systemdatetimegettime10示例如下:aboutToAppear(): void { try { let time = systemDateTime.getTime(true) console.log(JSON.stringify(time)) } catch(e) { let error = e as BusinessError; console.info(`Failed to get time. message: ${error.message}, code: ${error.code}`); } }
使用systemDateTime.getTime(),可以参考文档:
https://developer.huawei.com/consumer/cn/doc/harmonyos-references-V5/js-apis-date-time-V5\#systemdatetimegettime10
示例如下: