1e41f4b71Sopenharmony_ci# @ohos.enterprise.dateTimeManager (System Time Management) (System API) 2e41f4b71Sopenharmony_ci 3e41f4b71Sopenharmony_ciThe **dateTimeManager** module provides APIs for system time management. 4e41f4b71Sopenharmony_ci 5e41f4b71Sopenharmony_ci> **NOTE** 6e41f4b71Sopenharmony_ci> 7e41f4b71Sopenharmony_ci> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version. 8e41f4b71Sopenharmony_ci> 9e41f4b71Sopenharmony_ci> The APIs of this module can be used only in the stage model. 10e41f4b71Sopenharmony_ci> 11e41f4b71Sopenharmony_ci> The APIs of this module can be called only by a [device administrator application](../../mdm/mdm-kit-guide.md#introduction) that is [enabled](js-apis-enterprise-adminManager-sys.md#adminmanagerenableadmin). 12e41f4b71Sopenharmony_ci> 13e41f4b71Sopenharmony_ci> The APIs provided by this module are system APIs. 14e41f4b71Sopenharmony_ci 15e41f4b71Sopenharmony_ci## Modules to Import 16e41f4b71Sopenharmony_ci 17e41f4b71Sopenharmony_ci```ts 18e41f4b71Sopenharmony_ciimport { dateTimeManager } from '@kit.MDMKit'; 19e41f4b71Sopenharmony_ci``` 20e41f4b71Sopenharmony_ci 21e41f4b71Sopenharmony_ci## dateTimeManager.setDateTime 22e41f4b71Sopenharmony_ci 23e41f4b71Sopenharmony_cisetDateTime(admin: Want, time: number, callback: AsyncCallback\<void>): void 24e41f4b71Sopenharmony_ci 25e41f4b71Sopenharmony_ciSets the system time through the specified device administrator application. This API uses an asynchronous callback to return the result. 26e41f4b71Sopenharmony_ci 27e41f4b71Sopenharmony_ci**Required permissions**: ohos.permission.ENTERPRISE_SET_DATETIME 28e41f4b71Sopenharmony_ci 29e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Customization.EnterpriseDeviceManager 30e41f4b71Sopenharmony_ci 31e41f4b71Sopenharmony_ci 32e41f4b71Sopenharmony_ci**Parameters** 33e41f4b71Sopenharmony_ci 34e41f4b71Sopenharmony_ci| Name | Type | Mandatory | Description | 35e41f4b71Sopenharmony_ci| ----- | ----------------------------------- | ---- | ------- | 36e41f4b71Sopenharmony_ci| admin | [Want](../apis-ability-kit/js-apis-app-ability-want.md) | Yes | Device administrator application.| 37e41f4b71Sopenharmony_ci| time | number | Yes| Timestamp to set, in ms.| 38e41f4b71Sopenharmony_ci| callback | AsyncCallback\<void> | Yes| Callback used to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object.| 39e41f4b71Sopenharmony_ci 40e41f4b71Sopenharmony_ci**Error codes** 41e41f4b71Sopenharmony_ci 42e41f4b71Sopenharmony_ciFor details about the error codes, see [Enterprise Device Management Error Codes](errorcode-enterpriseDeviceManager.md) and [Universal Error Codes](../errorcode-universal.md). 43e41f4b71Sopenharmony_ci 44e41f4b71Sopenharmony_ci| ID| Error Message | 45e41f4b71Sopenharmony_ci| ------- | ---------------------------------------------------------------------------- | 46e41f4b71Sopenharmony_ci| 9200001 | The application is not an administrator application of the device. | 47e41f4b71Sopenharmony_ci| 9200002 | The administrator application does not have permission to manage the device. | 48e41f4b71Sopenharmony_ci| 201 | Permission verification failed. The application does not have the permission required to call the API. | 49e41f4b71Sopenharmony_ci| 202 | Permission verification failed. A non-system application calls a system API. | 50e41f4b71Sopenharmony_ci| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. | 51e41f4b71Sopenharmony_ci 52e41f4b71Sopenharmony_ci**Example** 53e41f4b71Sopenharmony_ci 54e41f4b71Sopenharmony_ci```ts 55e41f4b71Sopenharmony_ciimport { Want } from '@kit.AbilityKit'; 56e41f4b71Sopenharmony_cilet wantTemp: Want = { 57e41f4b71Sopenharmony_ci bundleName: 'bundleName', 58e41f4b71Sopenharmony_ci abilityName: 'abilityName', 59e41f4b71Sopenharmony_ci}; 60e41f4b71Sopenharmony_ci 61e41f4b71Sopenharmony_cidateTimeManager.setDateTime(wantTemp, 1526003846000, (err) => { 62e41f4b71Sopenharmony_ci if (err) { 63e41f4b71Sopenharmony_ci console.error(`Failed to set date time. Code is ${err.code}, message is ${err.message}`); 64e41f4b71Sopenharmony_ci return; 65e41f4b71Sopenharmony_ci } 66e41f4b71Sopenharmony_ci console.info('Succeeded in setting date time'); 67e41f4b71Sopenharmony_ci}) 68e41f4b71Sopenharmony_ci``` 69e41f4b71Sopenharmony_ci 70e41f4b71Sopenharmony_ci## dateTimeManager.setDateTime 71e41f4b71Sopenharmony_ci 72e41f4b71Sopenharmony_cisetDateTime(admin: Want, time: number): Promise\<void> 73e41f4b71Sopenharmony_ci 74e41f4b71Sopenharmony_ciSets the system time through the specified device administrator application. This API uses a promise to return the result. 75e41f4b71Sopenharmony_ci 76e41f4b71Sopenharmony_ci**Required permissions**: ohos.permission.ENTERPRISE_SET_DATETIME 77e41f4b71Sopenharmony_ci 78e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Customization.EnterpriseDeviceManager 79e41f4b71Sopenharmony_ci 80e41f4b71Sopenharmony_ci 81e41f4b71Sopenharmony_ci**Parameters** 82e41f4b71Sopenharmony_ci 83e41f4b71Sopenharmony_ci| Name | Type | Mandatory | Description | 84e41f4b71Sopenharmony_ci| ----- | ----------------------------------- | ---- | ------- | 85e41f4b71Sopenharmony_ci| admin | [Want](../apis-ability-kit/js-apis-app-ability-want.md) | Yes | Device administrator application.| 86e41f4b71Sopenharmony_ci| time | number | Yes| Timestamp to set, in ms.| 87e41f4b71Sopenharmony_ci 88e41f4b71Sopenharmony_ci**Return value** 89e41f4b71Sopenharmony_ci 90e41f4b71Sopenharmony_ci| Type | Description | 91e41f4b71Sopenharmony_ci| ----- | ----------------------------------- | 92e41f4b71Sopenharmony_ci| Promise\<void> | Promise that returns no value.| 93e41f4b71Sopenharmony_ci 94e41f4b71Sopenharmony_ci**Error codes** 95e41f4b71Sopenharmony_ci 96e41f4b71Sopenharmony_ciFor details about the error codes, see [Enterprise Device Management Error Codes](errorcode-enterpriseDeviceManager.md) and [Universal Error Codes](../errorcode-universal.md). 97e41f4b71Sopenharmony_ci 98e41f4b71Sopenharmony_ci| ID| Error Message | 99e41f4b71Sopenharmony_ci| ------- | ---------------------------------------------------------------------------- | 100e41f4b71Sopenharmony_ci| 9200001 | The application is not an administrator application of the device. | 101e41f4b71Sopenharmony_ci| 9200002 | The administrator application does not have permission to manage the device. | 102e41f4b71Sopenharmony_ci| 201 | Permission verification failed. The application does not have the permission required to call the API. | 103e41f4b71Sopenharmony_ci| 202 | Permission verification failed. A non-system application calls a system API. | 104e41f4b71Sopenharmony_ci| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. | 105e41f4b71Sopenharmony_ci 106e41f4b71Sopenharmony_ci**Example** 107e41f4b71Sopenharmony_ci 108e41f4b71Sopenharmony_ci```ts 109e41f4b71Sopenharmony_ciimport { Want } from '@kit.AbilityKit'; 110e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit'; 111e41f4b71Sopenharmony_cilet wantTemp: Want = { 112e41f4b71Sopenharmony_ci bundleName: 'bundleName', 113e41f4b71Sopenharmony_ci abilityName: 'abilityName', 114e41f4b71Sopenharmony_ci}; 115e41f4b71Sopenharmony_ci 116e41f4b71Sopenharmony_cidateTimeManager.setDateTime(wantTemp, 1526003846000).then(() => { 117e41f4b71Sopenharmony_ci console.info('Succeeded in setting date time'); 118e41f4b71Sopenharmony_ci}).catch((err: BusinessError) => { 119e41f4b71Sopenharmony_ci console.error(`Failed to set date time. Code is ${err.code}, message is ${err.message}`); 120e41f4b71Sopenharmony_ci}) 121e41f4b71Sopenharmony_ci``` 122e41f4b71Sopenharmony_ci 123e41f4b71Sopenharmony_ci## dateTimeManager.disallowModifyDateTime<sup>10+</sup> 124e41f4b71Sopenharmony_ci 125e41f4b71Sopenharmony_cidisallowModifyDateTime(admin: Want, disallow: boolean, callback: AsyncCallback\<void>): void 126e41f4b71Sopenharmony_ci 127e41f4b71Sopenharmony_ciForbids the specified device administrator application to modify the system time. This API uses an asynchronous callback to return the result. 128e41f4b71Sopenharmony_ci 129e41f4b71Sopenharmony_ci**Required permissions**: ohos.permission.ENTERPRISE_SET_DATETIME 130e41f4b71Sopenharmony_ci 131e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Customization.EnterpriseDeviceManager 132e41f4b71Sopenharmony_ci 133e41f4b71Sopenharmony_ci 134e41f4b71Sopenharmony_ci**Parameters** 135e41f4b71Sopenharmony_ci 136e41f4b71Sopenharmony_ci| Name | Type | Mandatory | Description | 137e41f4b71Sopenharmony_ci| ----- | ----------------------------------- | ---- | ------- | 138e41f4b71Sopenharmony_ci| admin | [Want](../apis-ability-kit/js-apis-app-ability-want.md) | Yes | Device administrator application.| 139e41f4b71Sopenharmony_ci| disallow | boolean | Yes| Whether to disallow modification of the system time. The value **true** means to disallow modification of the system time, and **false** means the opposite.| 140e41f4b71Sopenharmony_ci| callback | AsyncCallback\<void> | Yes| Callback used to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object.| 141e41f4b71Sopenharmony_ci 142e41f4b71Sopenharmony_ci**Error codes** 143e41f4b71Sopenharmony_ci 144e41f4b71Sopenharmony_ciFor details about the error codes, see [Enterprise Device Management Error Codes](errorcode-enterpriseDeviceManager.md) and [Universal Error Codes](../errorcode-universal.md). 145e41f4b71Sopenharmony_ci 146e41f4b71Sopenharmony_ci| ID| Error Message | 147e41f4b71Sopenharmony_ci| ------- | ---------------------------------------------------------------------------- | 148e41f4b71Sopenharmony_ci| 9200001 | The application is not an administrator application of the device. | 149e41f4b71Sopenharmony_ci| 9200002 | The administrator application does not have permission to manage the device. | 150e41f4b71Sopenharmony_ci| 201 | Permission verification failed. The application does not have the permission required to call the API. | 151e41f4b71Sopenharmony_ci| 202 | Permission verification failed. A non-system application calls a system API. | 152e41f4b71Sopenharmony_ci| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. | 153e41f4b71Sopenharmony_ci 154e41f4b71Sopenharmony_ci**Example** 155e41f4b71Sopenharmony_ci 156e41f4b71Sopenharmony_ci```ts 157e41f4b71Sopenharmony_ciimport { Want } from '@kit.AbilityKit'; 158e41f4b71Sopenharmony_cilet wantTemp: Want = { 159e41f4b71Sopenharmony_ci bundleName: 'bundleName', 160e41f4b71Sopenharmony_ci abilityName: 'abilityName', 161e41f4b71Sopenharmony_ci}; 162e41f4b71Sopenharmony_ci 163e41f4b71Sopenharmony_cidateTimeManager.disallowModifyDateTime(wantTemp, true, (err) => { 164e41f4b71Sopenharmony_ci if (err) { 165e41f4b71Sopenharmony_ci console.error(`Failed to disallow modify date time. Code is ${err.code}, message is ${err.message}`); 166e41f4b71Sopenharmony_ci return; 167e41f4b71Sopenharmony_ci } 168e41f4b71Sopenharmony_ci console.info('Succeeded in disallowing modify date time'); 169e41f4b71Sopenharmony_ci}) 170e41f4b71Sopenharmony_ci``` 171e41f4b71Sopenharmony_ci 172e41f4b71Sopenharmony_ci## dateTimeManager.disallowModifyDateTime<sup>10+</sup> 173e41f4b71Sopenharmony_ci 174e41f4b71Sopenharmony_cidisallowModifyDateTime(admin: Want, disallow: boolean): Promise\<void> 175e41f4b71Sopenharmony_ci 176e41f4b71Sopenharmony_ciForbids the specified device administrator application to modify the system time. This API uses a promise to return the result. 177e41f4b71Sopenharmony_ci 178e41f4b71Sopenharmony_ci**Required permissions**: ohos.permission.ENTERPRISE_SET_DATETIME 179e41f4b71Sopenharmony_ci 180e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Customization.EnterpriseDeviceManager 181e41f4b71Sopenharmony_ci 182e41f4b71Sopenharmony_ci 183e41f4b71Sopenharmony_ci**Parameters** 184e41f4b71Sopenharmony_ci 185e41f4b71Sopenharmony_ci| Name | Type | Mandatory | Description | 186e41f4b71Sopenharmony_ci| ----- | ----------------------------------- | ---- | ------- | 187e41f4b71Sopenharmony_ci| admin | [Want](../apis-ability-kit/js-apis-app-ability-want.md) | Yes | Device administrator application.| 188e41f4b71Sopenharmony_ci| disallow | boolean | Yes| Whether to disallow modification of the system time. The value **true** means to disallow modification of the system time, and **false** means the opposite.| 189e41f4b71Sopenharmony_ci 190e41f4b71Sopenharmony_ci**Return value** 191e41f4b71Sopenharmony_ci 192e41f4b71Sopenharmony_ci| Type | Description | 193e41f4b71Sopenharmony_ci| ----- | ----------------------------------- | 194e41f4b71Sopenharmony_ci| Promise\<void> | Promise that returns no value. If the operation fails, an error object will be thrown.| 195e41f4b71Sopenharmony_ci 196e41f4b71Sopenharmony_ci**Error codes** 197e41f4b71Sopenharmony_ci 198e41f4b71Sopenharmony_ciFor details about the error codes, see [Enterprise Device Management Error Codes](errorcode-enterpriseDeviceManager.md) and [Universal Error Codes](../errorcode-universal.md). 199e41f4b71Sopenharmony_ci 200e41f4b71Sopenharmony_ci| ID| Error Message | 201e41f4b71Sopenharmony_ci| ------- | ---------------------------------------------------------------------------- | 202e41f4b71Sopenharmony_ci| 9200001 | The application is not an administrator application of the device. | 203e41f4b71Sopenharmony_ci| 9200002 | The administrator application does not have permission to manage the device. | 204e41f4b71Sopenharmony_ci| 201 | Permission verification failed. The application does not have the permission required to call the API. | 205e41f4b71Sopenharmony_ci| 202 | Permission verification failed. A non-system application calls a system API. | 206e41f4b71Sopenharmony_ci| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. | 207e41f4b71Sopenharmony_ci 208e41f4b71Sopenharmony_ci**Example** 209e41f4b71Sopenharmony_ci 210e41f4b71Sopenharmony_ci```ts 211e41f4b71Sopenharmony_ciimport { Want } from '@kit.AbilityKit'; 212e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit'; 213e41f4b71Sopenharmony_cilet wantTemp: Want = { 214e41f4b71Sopenharmony_ci bundleName: 'bundleName', 215e41f4b71Sopenharmony_ci abilityName: 'abilityName', 216e41f4b71Sopenharmony_ci}; 217e41f4b71Sopenharmony_ci 218e41f4b71Sopenharmony_cidateTimeManager.disallowModifyDateTime(wantTemp, true).then(() => { 219e41f4b71Sopenharmony_ci console.info('Succeeded in disallowing modify date time'); 220e41f4b71Sopenharmony_ci}).catch((err: BusinessError) => { 221e41f4b71Sopenharmony_ci console.error(`Failed to disallow modify date time. Code is ${err.code}, message is ${err.message}`); 222e41f4b71Sopenharmony_ci}) 223e41f4b71Sopenharmony_ci``` 224e41f4b71Sopenharmony_ci 225e41f4b71Sopenharmony_ci## dateTimeManager.isModifyDateTimeDisallowed<sup>10+</sup> 226e41f4b71Sopenharmony_ci 227e41f4b71Sopenharmony_ciisModifyDateTimeDisallowed(admin: Want, callback: AsyncCallback\<boolean>): void 228e41f4b71Sopenharmony_ci 229e41f4b71Sopenharmony_ciChecks whether the system time modification is disallowed through the specified device administrator application. This API uses an asynchronous callback to return the result. 230e41f4b71Sopenharmony_ci 231e41f4b71Sopenharmony_ci**Required permissions**: ohos.permission.ENTERPRISE_SET_DATETIME 232e41f4b71Sopenharmony_ci 233e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Customization.EnterpriseDeviceManager 234e41f4b71Sopenharmony_ci 235e41f4b71Sopenharmony_ci 236e41f4b71Sopenharmony_ci**Parameters** 237e41f4b71Sopenharmony_ci 238e41f4b71Sopenharmony_ci| Name | Type | Mandatory | Description | 239e41f4b71Sopenharmony_ci| ----- | ----------------------------------- | ---- | ------- | 240e41f4b71Sopenharmony_ci| admin | [Want](../apis-ability-kit/js-apis-app-ability-want.md) | Yes | Device administrator application.| 241e41f4b71Sopenharmony_ci| callback | AsyncCallback\<boolean> | Yes| Callback used to return the result. The value **true** means the system time modification is disallowed, and **false** means the opposite.| 242e41f4b71Sopenharmony_ci 243e41f4b71Sopenharmony_ci**Error codes** 244e41f4b71Sopenharmony_ci 245e41f4b71Sopenharmony_ciFor details about the error codes, see [Enterprise Device Management Error Codes](errorcode-enterpriseDeviceManager.md) and [Universal Error Codes](../errorcode-universal.md). 246e41f4b71Sopenharmony_ci 247e41f4b71Sopenharmony_ci| ID| Error Message | 248e41f4b71Sopenharmony_ci| ------- | ---------------------------------------------------------------------------- | 249e41f4b71Sopenharmony_ci| 9200001 | The application is not an administrator application of the device. | 250e41f4b71Sopenharmony_ci| 9200002 | The administrator application does not have permission to manage the device. | 251e41f4b71Sopenharmony_ci| 201 | Permission verification failed. The application does not have the permission required to call the API. | 252e41f4b71Sopenharmony_ci| 202 | Permission verification failed. A non-system application calls a system API. | 253e41f4b71Sopenharmony_ci| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. | 254e41f4b71Sopenharmony_ci 255e41f4b71Sopenharmony_ci**Example** 256e41f4b71Sopenharmony_ci 257e41f4b71Sopenharmony_ci```ts 258e41f4b71Sopenharmony_ciimport { Want } from '@kit.AbilityKit'; 259e41f4b71Sopenharmony_cilet wantTemp: Want = { 260e41f4b71Sopenharmony_ci bundleName: 'bundleName', 261e41f4b71Sopenharmony_ci abilityName: 'abilityName', 262e41f4b71Sopenharmony_ci}; 263e41f4b71Sopenharmony_ci 264e41f4b71Sopenharmony_cidateTimeManager.isModifyDateTimeDisallowed(wantTemp, (err, result) => { 265e41f4b71Sopenharmony_ci if (err) { 266e41f4b71Sopenharmony_ci console.error(`Failed to query modify date time is disallowed or not. Code is ${err.code}, message is ${err.message}`); 267e41f4b71Sopenharmony_ci return; 268e41f4b71Sopenharmony_ci } 269e41f4b71Sopenharmony_ci console.info(`Succeeded in querying modify date time is disallowed : ${result}`); 270e41f4b71Sopenharmony_ci}) 271e41f4b71Sopenharmony_ci``` 272e41f4b71Sopenharmony_ci 273e41f4b71Sopenharmony_ci## dateTimeManager.isModifyDateTimeDisallowed<sup>10+</sup> 274e41f4b71Sopenharmony_ci 275e41f4b71Sopenharmony_ciisModifyDateTimeDisallowed(admin: Want): Promise\<boolean> 276e41f4b71Sopenharmony_ci 277e41f4b71Sopenharmony_ciChecks whether the system time modification is disallowed through the specified device administrator application. This API uses a promise to return the result. 278e41f4b71Sopenharmony_ci 279e41f4b71Sopenharmony_ci**Required permissions**: ohos.permission.ENTERPRISE_SET_DATETIME 280e41f4b71Sopenharmony_ci 281e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Customization.EnterpriseDeviceManager 282e41f4b71Sopenharmony_ci 283e41f4b71Sopenharmony_ci 284e41f4b71Sopenharmony_ci**Parameters** 285e41f4b71Sopenharmony_ci 286e41f4b71Sopenharmony_ci| Name | Type | Mandatory | Description | 287e41f4b71Sopenharmony_ci| ----- | ----------------------------------- | ---- | ------- | 288e41f4b71Sopenharmony_ci| admin | [Want](../apis-ability-kit/js-apis-app-ability-want.md) | Yes | Device administrator application.| 289e41f4b71Sopenharmony_ci 290e41f4b71Sopenharmony_ci**Return value** 291e41f4b71Sopenharmony_ci 292e41f4b71Sopenharmony_ci| Type | Description | 293e41f4b71Sopenharmony_ci| ----- | ----------------------------------- | 294e41f4b71Sopenharmony_ci| Promise\<boolean> | Promise used to return the result. The value **true** means the system time modification is disallowed, and **false** means the opposite.| 295e41f4b71Sopenharmony_ci 296e41f4b71Sopenharmony_ci**Error codes** 297e41f4b71Sopenharmony_ci 298e41f4b71Sopenharmony_ciFor details about the error codes, see [Enterprise Device Management Error Codes](errorcode-enterpriseDeviceManager.md) and [Universal Error Codes](../errorcode-universal.md). 299e41f4b71Sopenharmony_ci 300e41f4b71Sopenharmony_ci| ID| Error Message | 301e41f4b71Sopenharmony_ci| ------- | ---------------------------------------------------------------------------- | 302e41f4b71Sopenharmony_ci| 9200001 | The application is not an administrator application of the device. | 303e41f4b71Sopenharmony_ci| 9200002 | The administrator application does not have permission to manage the device. | 304e41f4b71Sopenharmony_ci| 201 | Permission verification failed. The application does not have the permission required to call the API. | 305e41f4b71Sopenharmony_ci| 202 | Permission verification failed. A non-system application calls a system API. | 306e41f4b71Sopenharmony_ci| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. | 307e41f4b71Sopenharmony_ci 308e41f4b71Sopenharmony_ci**Example** 309e41f4b71Sopenharmony_ci 310e41f4b71Sopenharmony_ci```ts 311e41f4b71Sopenharmony_ciimport { Want } from '@kit.AbilityKit'; 312e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit'; 313e41f4b71Sopenharmony_cilet wantTemp: Want = { 314e41f4b71Sopenharmony_ci bundleName: 'bundleName', 315e41f4b71Sopenharmony_ci abilityName: 'abilityName', 316e41f4b71Sopenharmony_ci}; 317e41f4b71Sopenharmony_ci 318e41f4b71Sopenharmony_cidateTimeManager.isModifyDateTimeDisallowed(wantTemp).then((result) => { 319e41f4b71Sopenharmony_ci console.info(`Succeeded in querying modify date time is disallowed : ${result}`); 320e41f4b71Sopenharmony_ci}).catch((err: BusinessError) => { 321e41f4b71Sopenharmony_ci console.error(`Failed to query modify date time is disallowed or not. Code is ${err.code}, message is ${err.message}`); 322e41f4b71Sopenharmony_ci}) 323e41f4b71Sopenharmony_ci``` 324