LoginSignup
20
22

More than 5 years have passed since last update.

【Android】Terminalから端末時間を変更する - adb shell date

Last updated at Posted at 2014-09-24

Androidで端末の時間をTerminal等から設定する場合、adb shell dateを使うとよい。
使い方は以下のような感じ。
※コマンド実行は可能ですが、Root化しないと時間が変更されないかも
→裏付け調査しました。【Android】adb shell date は System User or radio Groupじゃないと反映されない

adb shell date

adb shell date -s YYYYMMDD.hhmmss

※YYYYMMDD:年月日 hhmmss:時分秒

簡単にPCの時間と合わせられるように、Linux/MacとWindows用のコマンドを作ってみた。

Linux/Mac

adb shell date -s $(date +"%Y%m%d.%H%M%S")

Windows

adb shell date -s %date:~0,4%%date:~5,2%%date:~8,2%.%time:~0,2%%time:~3,2%%time:~6,2%

という感じ。

検証端末とか時間がおかしい端末を、一々設定開かなくても直せちゃうよ-。という利点。
後はAlarm等のテストをしたい時も、無理矢理時間変更したりするからオススメかなー。

20
22
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
20
22