你可以使用Date.now()方法获取,以下是demo@Entry @Component struct Index22 { @State formattedDate: string = ''; aboutToAppear(): void { let dateFormat = new Intl.DateTimeFormat('zh-CN', {dateStyle: 'short', timeStyle: 'short'}); this.formattedDate = dateFormat.format(Date.now()) console.log( this.formattedDate) } build() { Row() { Column() { Text(this.formattedDate) .fontSize(50) .fontWeight(FontWeight.Bold) } .width('100%') } .height('100%') } }参考文档:https://developer.huawei.com/consumer/cn/doc/harmonyos-guides...
你可以使用Date.now()方法获取,以下是demo
参考文档:https://developer.huawei.com/consumer/cn/doc/harmonyos-guides...