问题描述
我正在尝试使用ADB Shell设置日期/时间,但该外壳仅返回当前时间。
I´m trying to set the date/time using the ADB shell but the shell only returns the current time.
我尝试过:
adb shell date -s YYYYMMDD.HHmmss
和unix时间,如:
adb shell date 1318349236
有什么想法吗?
推荐答案
要保存存储空间像许多其他嵌入式系统一样,Android空间使用实施其基本命令行工具,例如 date
。
To save storage space Android like many other embedded systems uses multi-call binaries to implement its basic command line tools like date
.
Android设备可能包含 toolbox
或 toybox
(或两者)二进制文件,具体取决于版本。您可以通过运行 toolbox date
和来检查设备上可用的
命令。然后,您可以使用打印当前日期的日期。例如,对于Android 6.0或更高版本的设备,它可能类似于: date
工具的实现方式toybox日期
Android device may include either toolbox
or toybox
(or both) binary depending on the version. You can check which implementation of the date
tool available on your device by running toolbox date
and toybox date
commands. Then you can use the one which prints out the current date. For example for an Android 6.0+ device it might look like:
$ adb shell toybox date
Mon Jul 31 21:09:28 CDT 2017
$ adb shell toolbox date
date: no such tool
要使用工具箱日期
设置日期和时间,请使用 YYYYMMDD.HHmmss
格式:
To set date and time using toolbox date
use YYYYMMDD.HHmmss
format:
adb shell "su 0 toolbox date -s 20161231.235959"
如果玩具箱日期
,请使用 MMDDhhmm [[CC] YY] [。ss]
格式:
adb shell "su 0 toybox date 123123592016.59"
这篇关于使用ADB Shell设置日期/时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!