Rohan
Rohan

Reputation: 1805

how do i change timezone using adb

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.

Upvotes: 24

Views: 49682

Answers (7)

Yong
Yong

Reputation: 1998

adb shell service call alarm 3 s16 America/Phoenix, which will be effective immediately.

setprop with persist.sys.timezone only works after reboot.

Upvotes: 23

Moshe Yamini
Moshe Yamini

Reputation: 735

adb shell service call alarm 4 s16 America/Chicago

4 - stands for the fourth function in alarm service implementation.

s16 - stands for string argument type.

https://android.stackexchange.com/questions/34625/where-to-find-description-of-all-system-bin-service-calls

Upvotes: 5

Greg
Greg

Reputation: 9

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

Upvotes: 0

Alex
Alex

Reputation: 480

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

Upvotes: -2

Alex P.
Alex P.

Reputation: 31686

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"

Upvotes: 45

KsWoodsMan
KsWoodsMan

Reputation: 1

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 !!!

Upvotes: 0

ben_wing
ben_wing

Reputation: 1023

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.

Upvotes: -3

Related Questions