For AI agents and LLMs: a machine-readable index is available at llms.txt. A plain-Markdown version of any documentation page is available by appending .md to its URL.
Skip to main content

Set Device Date & Time

TestMu AI now supports configuring custom date, time, and hour-format on Real Devices via Appium during automation testing sessions. This allows developers and testers to simulate specific date/time conditions to validate use cases like scheduled events, alarms, chats, or localization for time formats.

By the end of this document, you will be able to:

  • Set a specific date and time on the device
  • Toggle between 12-hour and 24-hour formats
  • Enable/disable automatic time syncing with network settings

Support for Automation on Real Devices

To modify the date and time settings programmatically, use the lambda_executor Appium hook with the updateDeviceSettings action. You can provide multiple arguments including custom date, time, format toggle, and auto-time setting.


Supported Arguments

ArgumentFormatDescription
customDateMMM DD YYYYSets the device date. You can select a date up to 7 days from today.
customTimeHH:MMSets time in 24-hour format (e.g., 13:30). Display adapts based on twelveHourTime (shown as 1:30 PM if enabled).
twelveHourTimeOn / OffOn for 12-hour, Off for 24-hour format.
setAutomaticallyOn / OffEnables or disables syncing with network time.

💡 Note: When setAutomatically is turned On, all Other Arguments for Date and Time are automatically disabled on the device.


Appium Hook Example

driver.execute_script('lambda_executor: { 
"action": "updateDeviceSettings",
"arguments": {
"customDate": "Jun 20 2025",
"customTime": "15:05",
"twelveHourTime": "On",
"setAutomatically": "On"
}
}')

Supported Platforms

PlatformOS VersionSupport Status
iOS14 and aboveFully Supported
Android10 and aboveFully Supported
Unsupported Android Devices

Custom date and time configuration is not supported on certain Android device models, primarily from Motorola, Xiaomi, Oppo, and other Chinese OEMs. On these devices, the Appium hook will return the following error:

Custom date and time hook is not supported on this device. Please try on another device_id.

If you encounter this error, retry your automation run on a different Android device.


Example Use Cases

  • Validate how the app behaves across different time zones or locales.
  • Test reminder or calendar event triggering logic.
  • Test 12-hour vs. 24-hour format layout rendering.

For Configuring Device Date and Time during Manual Testing on Real Devices, please refer to our Set Date & Time on Real Devices (Manual) guide.

Test across 3000+ combinations of browsers, real devices & OS.

×
Schedule Your Personal Demo
Book Demo

Help and Support

Related Articles