>The APIs of this module are supported since API version 7.
> 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.
## Modules to Import<a name="s56d19203690d4782bfc74069abb6bd71"></a>
<td class="cellrowborder" valign="top" width="46.760000000000005%" headers="mcps1.1.5.1.4 "><p id="p19675312911"><a name="p19675312911"></a><a name="p19675312911"></a>Callback used to process the received return value</p>
</td>
</tr>
</tbody>
</table>
- Example
```
// Set the date and time to 2021-01-20 02:36:25.
var time = 1611081385000;
systemTime.setTime(time, (error, data) => {
if (error) {
console.error(`failed to systemTime.setTime because ` + JSON.stringify(error));
return;
}
console.log(`success to systemTime.setTime: ` + JSON.stringify(data));
<td class="cellrowborder" valign="top" width="47.232256174948745%" headers="mcps1.1.5.1.4 "><p id="p1822104212508"><a name="p1822104212508"></a><a name="p1822104212508"></a>Callback used to process the received return value</p>
</td>
</tr>
</tbody>
</table>
- Example
```
var data = new Date("October 13, 2020 11:13:00");
systemTime.setDate(data,(error, data) => {
if (error) {
console.error('SystemTimePlugin setDate failed because ' + JSON.stringify(error));
return;
}
console.info('SystemTimePlugin setDate success data : ' + JSON.stringify(data));
<td class="cellrowborder" valign="top" width="44.35%" headers="mcps1.1.5.1.4 "><p id="p1670792610618"><a name="p1670792610618"></a><a name="p1670792610618"></a>Callback used to process the received return value</p>
| isNano | boolean | No| Whether nanoseconds or milliseconds will be returned. If the value is **true**, nanoseconds will be returned. Otherwise, milliseconds will be returned.|
| callback | AsyncCallback<number> | Yes| Callback used to return the time.|
| isNano | boolean | No| Whether nanoseconds or milliseconds will be returned. If the value is **true**, nanoseconds will be returned. Otherwise, milliseconds will be returned.|
- Return value
| Type| Description|
| -------- | -------- |
| Promise<number> | Promise used to return the time.|
- Example
```
systemTime.getCurrentTime().then((data) => {
console.log(`systemTime.getCurrentTime success data : ` + JSON.stringify(data));
}).catch((error) => {
console.error(`failed to systemTime.getCurrentTime because ` + 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.|
| callback | AsyncCallback<number> | Yes| Callback used to return the time.|
| isNano | boolean | No| Whether nanoseconds or milliseconds will be returned. If the value is **true**, nanoseconds will be returned. Otherwise, milliseconds will be returned.|
- Return value
| Type| Description|
| -------- | -------- |
| Promise<number> | Promise used to return the time.|
- Example
```
systemTime.getCurrentTime().then((data) => {
console.log(`systemTime.getRealActiveTime success data : ` + JSON.stringify(data));
}).catch((error) => {
console.error(`failed to systemTime.getRealActiveTime because ` + 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.|
| callback | AsyncCallback<number> | Yes| Callback used to return the time.|
- Example
```
systemTime.getRealTime(true, (error, data) => {
if (error) {
console.error(`failed to systemTime.getRealTime because ` + 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.|
- Return value
| Type| Description|
| -------- | -------- |
| Promise<number> | Promise used to return the time.|