如何写精华回答,获更多曝光?
发布
参考代码如下:
let dateStr = ''
try {
//取日期时间戳
systemDateTime.getCurrentTime(true, (error, time) => {
if (error) {
console.info(`Failed to get currentTime. message: ${error.message}, code: ${error.code}`);
return;
}
dateStr = time.toString();
});
} catch(e) {
console.info(`Failed to get currentTime. message: ${e.message}, code: ${e.code}`);
}