|
| 1 | +--- |
| 2 | +id: appium-date-and-time |
| 3 | +title: Set Custom Date, Time & Hour Format on Real Devices |
| 4 | +hide_title: true |
| 5 | +sidebar_label: Set Date and Time |
| 6 | +description: This document provides information about configuring date, time, and hour-format on Real Devices using Appium automation on LambdaTest. |
| 7 | +keywords: |
| 8 | + - Appium |
| 9 | + - LambdaTest |
| 10 | + - Set Date and Time |
| 11 | + - Device Time Automation |
| 12 | + - 12-hour format |
| 13 | + - 24-hour format |
| 14 | + |
| 15 | +url: https://www.lambdatest.com/support/docs/appium-date-and-time/ |
| 16 | +site_name: LambdaTest |
| 17 | +slug: appium-date-and-time/ |
| 18 | +--- |
| 19 | + |
| 20 | + |
| 21 | +import CodeBlock from '@theme/CodeBlock'; |
| 22 | +import {YOUR_LAMBDATEST_USERNAME, YOUR_LAMBDATEST_ACCESS_KEY} from "@site/src/component/keys"; |
| 23 | + |
| 24 | +import Tabs from '@theme/Tabs'; |
| 25 | +import TabItem from '@theme/TabItem'; |
| 26 | + |
| 27 | +<script type="application/ld+json" |
| 28 | + dangerouslySetInnerHTML={{ __html: JSON.stringify({ |
| 29 | + "@context": "https://schema.org", |
| 30 | + "@type": "BreadcrumbList", |
| 31 | + "itemListElement": [{ |
| 32 | + "@type": "ListItem", |
| 33 | + "position": 1, |
| 34 | + "name": "Home", |
| 35 | + "item": "https://www.lambdatest.com" |
| 36 | + },{ |
| 37 | + "@type": "ListItem", |
| 38 | + "position": 2, |
| 39 | + "name": "Support", |
| 40 | + "item": "https://www.lambdatest.com/support/docs/" |
| 41 | + },{ |
| 42 | + "@type": "ListItem", |
| 43 | + "position": 3, |
| 44 | + "name": "Set Custom Date, Time & Hour Format on Real Devices", |
| 45 | + "item": "https://www.lambdatest.com/support/docs/appium-date-and-time/" |
| 46 | + }] |
| 47 | + }) |
| 48 | + }} |
| 49 | +></script> |
| 50 | + |
| 51 | +# Set Device Date & Time |
| 52 | + |
| 53 | +LambdaTest 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. |
| 54 | + |
| 55 | +By the end of this document, you will be able to: |
| 56 | +- Set a specific date and time on the device |
| 57 | +- Toggle between 12-hour and 24-hour formats |
| 58 | +- Enable/disable automatic time syncing with network settings |
| 59 | + |
| 60 | +--- |
| 61 | + |
| 62 | +## Support for Automation on Real Devices |
| 63 | + |
| 64 | +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. |
| 65 | + |
| 66 | +### Appium Hook Example |
| 67 | + |
| 68 | +<CodeBlock language="js"> |
| 69 | +{`driver.execute_script('lambda_executor: { |
| 70 | + "action": "updateDeviceSettings", |
| 71 | + "arguments": { |
| 72 | + "customDate": "Jun 20 2025", |
| 73 | + "customTime": "15:05", |
| 74 | + "twelveHourTime": "On", |
| 75 | + "setAutomatically": "On" |
| 76 | + } |
| 77 | +}')`} |
| 78 | +</CodeBlock> |
| 79 | + |
| 80 | + |
| 81 | +--- |
| 82 | +## Supported Arguments |
| 83 | + |
| 84 | +| Argument | Format | Description | |
| 85 | +| ------------------ | ------------- | --------------------------------------------------------------------------- | |
| 86 | +| `customDate` | `MMM DD YYYY` | Sets device date. Max 7 days from today. | |
| 87 | +| `customTime` | `HH:MM` | Time in 24-hour format (e.g., 13:30). Interpreted based on `twelveHourTime`.| |
| 88 | +| `twelveHourTime` | `On` / `Off` | `On` for 12-hour, `Off` for 24-hour format. | |
| 89 | +| `setAutomatically` | `On` / `Off` | Enables or disables syncing with network time. | |
| 90 | + |
| 91 | +> 💡 **Note:** When `setAutomatically` is turned **On**, manual inputs for date and time are disabled on the device. |
| 92 | +
|
| 93 | +--- |
| 94 | +## Supported Platforms |
| 95 | + |
| 96 | +| Platform | OS Version | Support Status | |
| 97 | +| --------- | ------------- | ------------------------------- | |
| 98 | +| iOS | 14 and above | ✅ Fully Supported | |
| 99 | +| Android | 10 and above | ⚠️ Manual: Supported🔧 Automation: In Progress | |
| 100 | + |
| 101 | +--- |
| 102 | + |
| 103 | +## Example Use Cases |
| 104 | + |
| 105 | +- Validate how the app behaves across different time zones or locales. |
| 106 | +- Test reminder or calendar event triggering logic. |
| 107 | +- Test 12-hour vs. 24-hour format layout rendering. |
| 108 | + |
| 109 | + |
| 110 | +> **Note:** For configuring device date and time during **manual testing** on real devices, please refer to our [Set Date & Time on Real Devices (Manual)](support/docs/set-date-time-hour-format-real-devices/) guide. |
| 111 | +
|
| 112 | + |
| 113 | + |
| 114 | +<nav aria-label="breadcrumbs"> |
| 115 | + <ul className="breadcrumbs"> |
| 116 | + <li className="breadcrumbs__item"> |
| 117 | + <a className="breadcrumbs__link" target="_self" href="https://www.lambdatest.com"> |
| 118 | + Home |
| 119 | + </a> |
| 120 | + </li> |
| 121 | + <li className="breadcrumbs__item"> |
| 122 | + <a className="breadcrumbs__link" target="_self" href="https://www.lambdatest.com/support/docs/"> |
| 123 | + Support |
| 124 | + </a> |
| 125 | + </li> |
| 126 | + <li className="breadcrumbs__item breadcrumbs__item--active"> |
| 127 | + <span className="breadcrumbs__link"> |
| 128 | + IP Geolocation |
| 129 | + </span> |
| 130 | + </li> |
| 131 | + </ul> |
| 132 | +</nav> |
0 commit comments