Date & Time¶
The device's current system date/time (adb shell date), read from the
device clock, not the MCP host's.
get_date_time
¶
Get the device's current system date/time: adb shell date.
Always reads the DEVICE's own clock via date, never the MCP host's —
the returned timestamp reflects what the device itself reports.
Requests an explicit, machine-readable ISO-8601-shaped +FORMAT
rather than date's locale-dependent default human-readable output,
so the result is predictable to parse. Read-only: setting the date,
time, or time zone is not supported.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
serial
|
str
|
The target device's adb serial (see list_connected_devices). |
required |
Returns:
| Type | Description |
|---|---|
DeviceDateTime
|
The serial, timestamp (ISO-8601 shaped, no time zone, e.g.
"2026-08-26T18:23:45"), and utc_offset (e.g. "+0000") when the
device's |
Error handling
An unknown serial or unresponsive adb binary raises
DEVICE_NOT_FOUND/ADB_UNAVAILABLE. If the device's date doesn't
support the requested timestamp format at all (output that doesn't
match the expected shape), that raises DEVICE_CLOCK_UNAVAILABLE.
If only the separate UTC-offset query is unsupported or fails for
a non-device reason, that's not treated as a failure of the call —
utc_offset simply comes back as None, still with a valid
timestamp. A permission rejection raises PERMISSION_DENIED; any
other failure raises a generic BACKEND_ERROR.
Example
Called with serial="emulator-5554". A typical response:
{
"status": "success",
"message": "Device time on emulator-5554: 2026-08-26T18:23:45+0000.",
"data": {
"serial": "emulator-5554",
"timestamp": "2026-08-26T18:23:45",
"utc_offset": "+0000"
},
"error": null
}