使用ADB Shell设置日期/时间 [英] Set date/time using ADB shell

查看:3228
本文介绍了使用ADB Shell设置日期/时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用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 来检查设备上可用的 date 工具的实现方式toybox日期命令。然后,您可以使用打印当前日期的日期。例如,对于Android 6.0或更高版本的设备,它可能类似于:

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设置日期/时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆