eclipse Android:如何更改模拟器中的时间?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2625169/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 14:37:20  来源:igfitidea点击:

Android: how to change the time in emulator?

androideclipseandroid-emulator

提问by Capsud

I've noticed that the time in my emulator for android projects is wrong. Its one hour behind. How do I go about changing the time and can I do it in eclipse?

我注意到我的 android 项目模拟器中的时间是错误的。它落后一小时。我如何改变时间,我可以在日食中做到吗?

回答by Jeff Hoye

Run>Debug Configurations/Run Configurations

运行>调试配置/运行配置

Tab Target> Additional Emulator Command Line Options

选项卡目标> 其他模拟器命令行选项

-timezone America/New_York

-timezone America/New_York

回答by manoj kumar gupta

use this command

使用这个命令

C:\> adb shell

#date –- 2009-10-01 14:24:59

20070325.123456

#date –s 20070325.123456

回答by Mark B

I believe the emulator is set to the GMT timezone by default. You can specify the timezone for the emulator with the -timezoneparameter.

我相信模拟器默认设置为 GMT 时区。您可以使用-timezone参数指定模拟器的时区。

https://developer.android.com/studio/run/emulator-commandline.html

https://developer.android.com/studio/run/emulator-commandline.html

回答by trante

If you use IntelliJ you can do that from Run/Edit Configurations window. Go to Emulator tab and add this to "Additional command line options":

如果您使用 IntelliJ,则可以从“运行/编辑配置”窗口执行此操作。转到 Emulator 选项卡并将其添加到“其他命令行选项”:

-timezone Europe/Helsinki

-时区欧洲/赫尔辛基

Android documentgives this info:

Android文档提供了以下信息:

-timezone Set the timezone for the emulated device to , instead of the host's timezone. must be specified in zoneinfo format. For example: "America/Los_Angeles" "Europe/Paris"

-timezone 将模拟设备的时区设置为 ,而不是主机的时区。必须以 zoneinfo 格式指定。例如:“美国/洛杉矶”“欧洲/巴黎”

Zoneinfo format is also known as tz database. So to find you specific timezone, you can use the Wikipedia list here:
http://en.wikipedia.org/wiki/List_of_tz_database_time_zones

Zoneinfo 格式也称为tz 数据库。所以要找到你特定的时区,你可以在这里使用维基百科列表:http:
//en.wikipedia.org/wiki/List_of_tz_database_time_zones

回答by Alex Accaci

If you want to change date & time, from running emulator window go to:

如果要更改日期和时间,请从运行模拟器窗口转到:

Apps -> Settings -> Date & Time -> Disable Automatic date & time -> Set date & Set time

If you want to change timezone, from running emulator window go to:

如果要更改时区,请从运行模拟器窗口转到:

Apps -> Settings -> Date & Time -> Disable Automatic time zone -> Select time zone

回答by Manish

Increase emulator date by some certain hours, Perfectly working Here i am increasing time by 4 hours.

将模拟器日期增加一些小时,完美工作在这里我将时间增加了 4 小时。

adb root adb shell "date date +09190400"

adb root adb shell“日期date +09190400

Month & Date : 0919(mmdd) hours : 04

月份和日期 : 0919(mmdd) 小时 : 04

回答by Conrad

I have searched extensively, and it seems like the only option is to turn off the Auto-Set time in the emulator phone prefs, and manually set the timezone. I can't find any place to set emulatoroptions from inside Eclipse/AVD Manager.

我进行了广泛的搜索,似乎唯一的选择是关闭模拟器手机首选项中的自动设置时间,并手动设置时区。我emulator在 Eclipse/AVD 管理器中找不到任何设置选项的地方。

回答by user538565

refer to this page
http://ysl-paradise.blogspot.com/2008/09/android.html
in the comment part.

请参阅此页面
http://ysl-paradise.blogspot.com/2008/09/android.html
在评论部分。

回答by chichilatte

The question was 9 years ago, but these days (on a mac at least) you just change you're mac's time in the OSX System Preferences Date & Time pane and it's immediately mirrored in the Android emulator.

问题是 9 年前的问题,但现在(至少在 mac 上)您只需在 OSX 系统首选项日期和时间窗格中更改您的 mac 时间,它就会立即反映在 Android 模拟器中。