Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set the date from a shell on Android

Tags:

android

For debugging purposes, I would like to run my app on a certain date. I can change the date manually on my emulator, of course, but I was wondering if there was a simple way to do it from the emulator shell (I know it can't be done from the UI).

like image 929
Joey Marianer Avatar asked Mar 14 '11 15:03

Joey Marianer


2 Answers

I am working with Win 7.

The correct format that worked for me is:

adb shell date -s "YYYYMMDD.hhmmss"

I saw in other threads this command, what really made the difference for me was to set under settings->Date & Time the options in this way. (Unselect the automatic date and time and time zone)

Date and time in the emulator

Commands from adb

like image 42
kiquenet85 Avatar answered Oct 03 '22 03:10

kiquenet85


Passing seconds-since-epoch as per previous answer didn't work on my instance (WinXP Android SDK11 HVGA_1.6 emulator). However this particular format worked:

adb shell date -s "yyyymmdd.[[[hh]mm]ss]"

[Edited 6/27/2011: Added the time portion of the syntax.]

like image 176
cdhabecker Avatar answered Oct 03 '22 02:10

cdhabecker