This module is used to set and obtain the current system date, time, and time zone.
The **systemTime** module provides system time and time zone features. You can use the APIs of this module to set and obtain the system time and time zone.
> **NOTE**<br>The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> **NOTE**
>
> The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
| isNano | boolean | No| Whether nanoseconds or milliseconds will be returned. If the value is **true**, nanoseconds will be returned. Otherwise, milliseconds will be returned.|
| isNano | boolean | No | Whether the time to return is in nanoseconds.<br>- **true**: in nanoseconds (ns).<br>- **false**: in milliseconds (ms).|
| callback | AsyncCallback<number> | Yes| Callback used to return the time.|
| callback | AsyncCallback<number> | Yes | Callback used to return the time elapsed since the Unix epoch. |
**Example**
**Example**
```js
```js
systemTime.getCurrentTime(true,(error,data)=>{
systemTime.getCurrentTime(true,(error,data)=>{
if(error){
if(error){
console.error(`failed to systemTime.getCurrentTime because `+JSON.stringify(error));
console.error(`Failed to get systemTime. Cause:`+JSON.stringify(error));
return;
return;
}
}
console.log(`systemTime.getCurrentTime success data : `+JSON.stringify(data));
console.log(`Succeeded in getting systemTime.Data: `+JSON.stringify(data));
});
});
```
```
## systemTime.getCurrentTime<sup>8+</sup>
## systemTime.getCurrentTime<sup>8+</sup>
...
@@ -118,144 +114,139 @@ Obtains the time elapsed since the Unix epoch. This API uses a promise to return
...
@@ -118,144 +114,139 @@ Obtains the time elapsed since the Unix epoch. This API uses a promise to return
| isNano | boolean | No| Whether nanoseconds or milliseconds will be returned. If the value is **true**, nanoseconds will be returned. Otherwise, milliseconds will be returned.|
| isNano | boolean | No | Whether the time to return is in nanoseconds.<br>- **true**: in nanoseconds (ns).<br>- **false**: in milliseconds (ms).|
| isNano | boolean | No| Whether nanoseconds or milliseconds will be returned. If the value is **true**, nanoseconds will be returned. Otherwise, milliseconds will be returned.|
| isNano | boolean | No | Whether the time to return is in nanoseconds.<br>- **true**: in nanoseconds (ns).<br>- **false**: in milliseconds (ms).|
| callback | AsyncCallback<number> | Yes| Callback used to return the time.|
| callback | AsyncCallback<number> | Yes| Callback used to return the time.|
**Example**
**Example**
```js
```js
systemTime.getRealActiveTime(true,(error,data)=>{
systemTime.getRealActiveTime(true,(error,data)=>{
if(error){
if(error){
console.error(`failed to systemTime.getRealActiveTimebecause `+JSON.stringify(error));
console.error(`Failed to get real active systemTime. Cause:`+JSON.stringify(error));
return;
return;
}
}
console.log(`systemTime.getRealActiveTime success data : `+JSON.stringify(data));
console.log(`Succeeded in getting real active systemTime. Data: `+JSON.stringify(data));
| isNano | boolean | No| Whether nanoseconds or milliseconds will be returned. If the value is **true**, nanoseconds will be returned. Otherwise, milliseconds will be returned.|
| isNano | boolean | No | Whether the time to return is in nanoseconds.<br>- **true**: in nanoseconds (ns).<br>- **false**: in milliseconds (ms).|
| isNano | boolean | No| Whether nanoseconds or milliseconds will be returned. If the value is **true**, nanoseconds will be returned. Otherwise, milliseconds will be returned.|
| isNano | boolean | No | Whether the time to return is in nanoseconds.<br>- **true**: in nanoseconds (ns).<br>- **false**: in milliseconds (ms).|
| callback | AsyncCallback<number> | Yes| Callback used to return the time.|
| callback | AsyncCallback<number> | Yes | Callback used to return the time. |
**Example**
**Example**
```js
```js
systemTime.getRealTime(true,(error,data)=>{
systemTime.getRealTime(true,(error,data)=>{
if(error){
if(error){
console.error(`failed to systemTime.getRealTime because `+JSON.stringify(error));
console.error(`Failed to get real systemTime. Cause:`+JSON.stringify(error));
| isNano | boolean | No| Whether nanoseconds or milliseconds will be returned. If the value is **true**, nanoseconds will be returned. Otherwise, milliseconds will be returned.|
| isNano | boolean | No | Whether the time to return is in nanoseconds.<<br>- **true**: in nanoseconds (ns).<br>- **false**: in milliseconds (ms).|
> - The **<dialog>** component does not support the **focusable** and **click-effect** attributes.
> The **\<dialog>** component does not support the **focusable** and **click-effect** attributes.
## Styles
## Styles
Only the **width**, **height**, **margin**, **margin-[left|top|right|bottom]**, and **margin-[start|end]** styles in [Universal Styles](js-components-common-styles.md) are supported.
Only the **width**, **height**, **margin**, **margin-[left|top|right|bottom]**, and **margin-[start|end]** styles in [Universal Styles](../arkui-js/js-components-common-styles.md) are supported.
## Events
Events in [Universal Events](js-components-common-events.md) are not supported. The following table lists the supported event.
## Events
The following events are supported. The [universal events](../arkui-js/js-components-common-events.md) are not supported.
| cancel | - | Triggered when a user taps a non-dialog area to cancel the pop-up. |
| show7+ | - | Triggered when the pop-up is displayed. |
| close7+ | - | Triggered when the pop-up is closed. |
## Methods
## Methods
Methods in [Universal Methods](js-components-common-methods.md) are not supported. The following table lists the supported methods.
The following methods are supported. The [universal methods](../arkui-js/js-components-common-methods.md) are not supported.
| Name | Parameter | Description |
| ----- | ---- | ------ |
| show | - | Shows a dialog box.|
| close | - | Close the dialog box.|
| Name | Parameter | Description |
> **NOTE**
| ----- | --------- | -------------------- |
>
| show | - | Shows a dialog box. |
> Attributes and styles of a **\<dialog>** component cannot be dynamically updated.
| close | - | Closes a dialog box. |
>  **NOTE:** Attributes and styles of a **\<dialog>** component cannot be dynamically updated.
## Example Code
## Example
```
```html
<!-- xxx.hml -->
<!-- xxx.hml -->
<divclass="doc-page">
<divclass="doc-page">
<divclass="btn-div">
<divclass="btn-div">
...
@@ -73,6 +79,9 @@ Methods in [Universal Methods](js-components-common-methods.md) are not supporte
...
@@ -73,6 +79,9 @@ Methods in [Universal Methods](js-components-common-methods.md) are not supporte
</div>
</div>
</dialog>
</dialog>
</div>
</div>
```
```css
/* xxx.css */
/* xxx.css */
.doc-page{
.doc-page{
flex-direction:column;
flex-direction:column;
...
@@ -119,30 +128,33 @@ Methods in [Universal Methods](js-components-common-methods.md) are not supporte
...
@@ -119,30 +128,33 @@ Methods in [Universal Methods](js-components-common-methods.md) are not supporte
| badgeSize | number \| string | No | 16 | Badge size, in vp. This parameter cannot be set in percentage. If it is set to an invalid value, the default value is used.|