how do i change timezone using adb

2019-01-18 11:15发布

I want to change the timezone using adb shell command.

I went through some posts which allow changing it in linux, but they are not valid for android.

标签: android adb
5条回答
三岁会撩人
2楼-- · 2019-01-18 11:38

This works with ADB

Get current global time zone:

adb shell settings get global time_zone              

Set a time zone:

adb shell settings put global time_zone Europe/Madrid

Time zones list:

https://en.wikipedia.org/wiki/List_of_tz_database_time_zones

查看更多
Rolldiameter
3楼-- · 2019-01-18 11:44

Please see this https://gist.github.com/jpkrause/6b7e576894a800d451bf for answer to your question.

So in your case it would be: adb shell setprop persist.sys.timezone America/Chicago

查看更多
▲ chillily
4楼-- · 2019-01-18 11:52

For the list of tzdata values I go to http://en.wikipedia.org/wiki/List_of_tz_database_time_zones

To set the timezone use setprop persist.sys.timezone <TZ> command:

setprop persist.sys.timezone "America/Chicago"
查看更多
Animai°情兽
5楼-- · 2019-01-18 11:56

In my (very) limited experience I have been able to edit the /system/build.prop file. I change the line in there that says persist.sys.timezone=America/Sao_Pao or some such drival to persist.sys.timezone=America/Chicago for my timezone CDT. I also changed the lines persist.sys.language=bt and persist.sys.country=AR to persist.sys.language=en and persist.sys.country=US respectively.

There are a few other things you can tweak in the file that will persist after a system restore. You might want to make sure that the build.prop file in a flash image or directory has the correct lines in it.

The /system/property directory seems to hold several text files with a single value. These seem to show up after using setprop but the OS doesn't seem to reflect the changes.

Editing these files usually does require root access either with a term program or the ADB.exe shell. (ADB = Android Device Bridge available in the Android SDK) I found ADB.exe while looking through the firmware downloads at JXD.HK for the S18 MiniPad. In the files.rar dl there is also the SuperUser.apk and a rooted version of busybox and su.

Best of Luck !!!

查看更多
叛逆
6楼-- · 2019-01-18 11:56

I changed 2 files to change my timezone.

the one that i don't entire know if it's necessary, but it keeps things in sync:

  /etc/timezone

the more one you for sure need to change:

  /etc/localtime

from http://www.cyberciti.biz/faq/linux-unix-set-tz-environment-variable/ you can determine the name of the timezone you want with tzselect.

I took inspiration from http://www.cyberciti.biz/faq/howto-set-date-and-time-timezone-in-freebsd/ and copied my timezone file from /usr/share/zoneinfo/ to /etc/localtime.

/etc/timezone is a text file with the name of the timezone. so i just updated it to match the value provided by tzselect.

查看更多
登录 后发表回答