getDeviceTime(String format) doesn't format the system time
See original GitHub issueThe problem
Method getDeviceTime(String format)
isn’t formatting the time correctly.
Environment
- Appium version (or git revision) that exhibits the issue: 1.15.1
- Desktop OS/version used to run Appium: macOS Mojave 10.14.6
- Mobile platform/version under test: Android 9
- Real device or emulator/simulator: emulator
- Appium CLI or Appium.app|exe: CLI
Code To Reproduce Issue [ Good To Have ]
androidDriver.getDeviceTime("HH:mm");
I was expecting to get:
16:00
but got this:
2020-04-02T16:00:20-03:00
(which I think is the default ISO8601)
Issue Analytics
- State:
- Created 3 years ago
- Comments:6
Top Results From Across the Web
Standard date and time format strings
The "D" standard format specifier represents a custom date and time format string that is defined by the current DateTimeFormatInfo.
Read more >C# DateTime to "YYYYMMDDHHMMSS" format
I would like this format: yyyyMMddHHmm[+-]ZZzz where The [+-]ZZzz part is the timezone (the number of hours to be added or substracted from...
Read more >date - Manual
Returns a string formatted according to the given format string using the given integer timestamp (Unix timestamp) or the current time if no...
Read more >MATLAB datestr
Convert Date and Time to Specific Format ... Format the current date in the mm/dd/yy format. You can specify this format using symbolic...
Read more >DateTimeFormatter (Java Platform SE 8 )
LocalDate date = LocalDate.now(); String text = date.format(formatter); ... During parsing the date-time value is converted to the chronology before it is ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This should work now with appium@beta + java-client snapshot from
master
branch (commit cc4003f8217b2dc885b8c5c72f51712cf29f9793).In case there is no possibility to switch then you could parse the returned ISO timestamp on the client side, for example using Java8 datetime helpers
I see that this was resolved by https://github.com/appium/java-client/pull/1332 for the Java appium client, but I find this issue confusing.
It seems to be a report that the Appium server itself doesn’t respond to a time-response formatting parameter in the GET request. (“…Selenium, which does not support sending parameters in GET requests.”) The intended name of that parameter is never mentioned at all in this ticket. (Which is a problem, because there’s no such documented parameter for this Appium endpoint?) And the logs pasted above indicate that there was no attempt by the client to send any time formatting parameter. (So of course the parameter that was never sent by the client wasn’t used by the server. How is that an Appium server bug?)
The server logs show that the client sent:
GET /wd/hub/session/d30d34f7-b7c6-4a16-a4c7-a50622fd5a6f/appium/device/system_time
And that request matches the current public Appium documentation, which indicates that there is no support for a time formatting parameter: http://appium.io/docs/en/commands/device/system/system-time/
Then this ticket, about the Appium server (?), was closed based on a change made to the Java appium client (only that one client?) rather than any change to the Appium server?
I had to read this very closely to see that no change was reported to the Appium server, and that the change reported to one particular Appium client library is not even “supposed to” work, according to the current docs for Appium server. So this is all kind of confusing. I’m not sure I can suggest a way to make things clearer, other than perhaps to update the Appium copy of the documentation for the Java client (at http://appium.io/docs/en/commands/device/system/system-time/#0_0) to indicate that the Java client is not even using this endpoint any more? (It’s diverting to an Appium ‘mobile’ script command?) and to show the new support for a “format” parameter? (Which I had to look at the other Java client issue to find out is the name of the parameter that’s being sent.)
Maybe my leaving this comment will un-confuse anyone who comes along reading in my footsteps.