how do i change timezone using adb

前端 未结 6 609
我寻月下人不归
我寻月下人不归 2020-12-05 19:30

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.

相关标签:
6条回答
  • 2020-12-05 19:53

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

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

    0 讨论(0)
  • 2020-12-05 19:57

    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

    0 讨论(0)
  • 2020-12-05 19:57

    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.

    0 讨论(0)
  • 2020-12-05 20:12

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

    0 讨论(0)
  • 2020-12-05 20:13

    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

    0 讨论(0)
  • 2020-12-05 20:18

    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"
    
    0 讨论(0)
提交回复
热议问题