多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
# 获取系统时间 获取设备上的时间 [//]: # (DO NOT EDIT THIS FILE! This is an auto-generated file. Editing for this document happens in /commands-yml/commands/device/system/system-time.yml) ## 使用样例 ```java // Java String time = driver.getDeviceTime(); ``` ```python # Python time = self.driver.device_time time = self.driver.get_device_time() time = self.driver.get_device_time("YYYY-MM-DD") ``` ```javascript // Javascript // webdriver.io example let time = driver.getDeviceTime(); // wd example let time = await driver.getDeviceTime(); ``` ```ruby # Ruby # ruby_lib example device_time # ruby_lib_core example @driver.device_time ``` ```php # PHP $time = $driver->getDeviceTime(); ``` ```csharp // C# string result = driver.DeviceTime; ``` ## 支持 ### Appium Server |平台|Driver|平台版本|Appium版本|Driver 版本| |--------|----------------|------|--------------|--------------| | iOS | [XCUITest](../../drivers/ios-xcuitest.md) | 9.3+ | 1.6.0+ | All | | | [UIAutomation](../../drivers/ios-uiautomation.md) | 8.0 to 9.3 | All | All | | Android | [Espresso](../../drivers/android-espresso.md) | ?+ | 1.9.0+ | All | | | [UiAutomator2](../../drivers/android-uiautomator2.md) | ?+ | 1.6.0+ | All | | | [UiAutomator](../../drivers/android-uiautomator.md) | 4.3+ | All | All | | Mac | [Mac](../../drivers/mac.md) | None | None | None | | Windows | [Windows](../../drivers/windows.md) | None | None | None | ### Appium 客户端 |语言|支持版本|文档| |--------|-------|-------------| |[Java](https://github.com/appium/java-client/releases/latest)| All | [appium.github.io](https://appium.github.io/java-client/io/appium/java_client/HasDeviceTime.html#getDeviceTime--) | |[Python](https://github.com/appium/python-client/releases/latest)| All | [appium.github.io](https://appium.github.io/python-client-sphinx/webdriver.extensions.html#webdriver.extensions.device_time.DeviceTime.device_time) | |[Javascript (WebdriverIO)](http://webdriver.io/index.html)| All | | |[Javascript (WD)](https://github.com/admc/wd/releases/latest)| All | [github.com](https://github.com/admc/wd/blob/master/lib/commands.js#L3119) | |[Ruby](https://github.com/appium/ruby_lib/releases/latest)| All | [www.rubydoc.info](https://www.rubydoc.info/github/appium/ruby_lib_core/Appium/Core/Device#device_time-instance_method) | |[PHP](https://github.com/appium/php-client/releases/latest)| All | [github.com](https://github.com/appium/php-client/) | |[C#](https://github.com/appium/appium-dotnet-driver/releases/latest)| All | [github.com](https://github.com/appium/appium-dotnet-driver/) | ## HTTP API 规范 ### 端点 `GET /session/:session_id/appium/device/system_time` ### URL 参数 |名称|描述| |----|-----------| |session_id|用来发送指令的会话id| ### JSON 参数 None ### 响应 设备上的时间 (`string`) ## 参考 * [JSONWP Specification](https://github.com/appium/appium-base-driver/blob/master/lib/protocol/routes.js#L357)