6

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?

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Capsud
  • 609
  • 4
  • 8
  • 16

10 Answers10

6

Run>Debug Configurations/Run Configurations

Tab Target> Additional Emulator Command Line Options

-timezone America/New_York

David Snabel-Caunt
  • 57,804
  • 13
  • 114
  • 132
Jeff Hoye
  • 580
  • 5
  • 11
3

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

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

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Mark B
  • 183,023
  • 24
  • 297
  • 295
3

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
kiner_shah
  • 3,939
  • 7
  • 23
  • 37
3

use this command

C:\> adb shell

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

20070325.123456

#date –s 20070325.123456
j0k
  • 22,600
  • 28
  • 79
  • 90
1

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":

-timezone Europe/Helsinki

Android document gives this info:

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

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

trante
  • 33,518
  • 47
  • 192
  • 272
1

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

adb root adb shell "date date +09190400"

Month & Date : 0919(mmdd) hours : 04

Manish
  • 1,085
  • 9
  • 5
0

Set the time on the emulator via ADB:

Bash:

adb root
adb shell "date $(date +%m%d%H%M%G.%S)"
adb shell "am broadcast -a android.intent.action.TIME_SET"

Powershell:

$currentDate = Get-Date -Format "MMddHHmmyyyy.ss" # Android's preferred format
adb root
adb shell "date $currentDate"
adb shell "am broadcast -a android.intent.action.TIME_SET"

The am broadcast signal the clock to update in the status-bar, though its not needed according to my tests on emulator API-31.

The adb root lets following adb command execute with root-access, which is needed to set the date.

Thanks to RipTutorial

See also duplicate Stackoverflow with more info for special android-devices: Set date/time using ADB shell

arberg
  • 4,148
  • 4
  • 31
  • 39
0

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 emulator options from inside Eclipse/AVD Manager.

Conrad
  • 2,197
  • 28
  • 53
-1

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

chichilatte
  • 1,697
  • 19
  • 21
-1

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

user538565
  • 513
  • 1
  • 6
  • 21