如何使用 adb 更改时区

发布于 2024-12-14 17:43:19 字数 78 浏览 0 评论 0原文

我想使用 adb shell 命令更改时区。

我浏览了一些允许在 Linux 中更改它的帖子,但它们对 Android 无效。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(7

空袭的梦i 2024-12-21 17:43:25

我更改了 2 个文件来更改我的时区。

我不完全知道是否有必要,但它使事情保持同步:

  /etc/timezone

您肯定需要更改的内容:

  /etc/localtime

来自 http://www.cyberciti.biz/faq/linux-unix-set-tz-environment-variable/ 即可确定名称您想要的时区tzselect

我从 http://www. cyberciti.biz/faq/howto-set-date-and-time-timezone-in-freebsd/
并将我的时区文件从 /usr/share/zoneinfo/ 复制到 /etc/localtime

/etc/timezone 是一个带有时区名称的文本文件。所以我只是更新了它以匹配 tzselect 提供的值。

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.

只是我以为 2024-12-21 17:43:24

请参阅此 https://gist.github.com/jpkrause/6b7e576894a800d451bf 来回答您的问题问题。

所以在你的情况下它将是:
adb shell setprop persist.sys.timezone 美国/芝加哥

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

把回忆走一遍 2024-12-21 17:43:24

这适用于 ADB

获取当前全球时区:

adb shell settings get global time_zone              

设置时区:

adb shell settings put global time_zone Europe/Madrid

时区列表:

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

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

神回复 2024-12-21 17:43:23

以我(非常)有限的经验,我已经能够编辑 /system/build.prop 文件。我将其中的 persist.sys.timezone=America/Sao_Pao 或类似驱动器的行更改为 persist.sys.timezone=America/Chicago 作为我的时区 CDT。我还分别将 persist.sys.language=bt 和 persist.sys.country=AR 行更改为 persist.sys.language=en 和 persist.sys.country=US 。

您还可以在该文件中调整一些其他内容,这些内容在系统还原后仍将保留。您可能需要确保 Flash 映像或目录中的 build.prop 文件包含正确的行。

/system/property 目录似乎包含多个具有单个值的文本文件。这些似乎在使用 setprop 之后出现,但操作系统似乎没有反映这些更改。

编辑这些文件通常需要使用术语程序或 ADB.exe shell 进行 root 访问。 (ADB = Android SDK 中提供的 Android Device Bridge)我在 JXD.HK 上查找 S18 MiniiPad 的固件下载时发现了 ADB.exe。在 files.rar dl 中,还有 SuperUser.apk 以及 busybox 和 su 的 root 版本。

祝你好运!

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

终难愈 2024-12-21 17:43:22
adb shell service call alarm 4 s16 America/Chicago

4 - 代表报警服务实现中的第四个功能。

s16 - 代表字符串参数类型。

https://android.stackexchange.com/ questions/34625/在哪里可以找到所有系统bin服务调用的描述

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

风启觞 2024-12-21 17:43:21

对于 tzdata 值列表,我访问 http://en.wikipedia.org/wiki/List_of_tz_database_time_zones

要设置时区,请使用 setprop persist.sys.timezone命令:

setprop persist.sys.timezone "America/Chicago"

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"
十级心震 2024-12-21 17:43:21

adb shell service call Alarm 3 s16 America/Phoenix,立即生效。

setproppersist.sys.timezone 仅在重新启动后才有效。

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

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文