BACKGROUND
I am working on a project using the Wi-fi only version of the Samsung Galaxy tab (7"). On some of the devices we are seeing the date/time on the device getting reset (don't know why) to some date in the past (like 1/1/2000).
QUESTION(S)
How can I programmatically reset the device date/time? I'd prefer to use some adb shell command if possible (my shell scripting is rusty). If there is no shell command that can accomplish this, is there a way to accomplish this by writing and installing an app (seems like a security violation)?
You can use the next command:
adb shell date -s YYYYMMDD.HHmmss
example:
adb shell date -s 20120423.130000
sets the date to Mon Apr 23 13:00:00 CEST 2012
(my phone is on CEST time zone)
I made this perl
script to handle this problem:
clock.pl
use Time::localtime;
$_=localtime;
system'adb','shell','date -s',sprintf("%04d%02d%02d.%02d%02d%02d",$_->year+1900,$_->mon+1,$_->mday,$_->hour,$_->min,$_->sec)
Call it using cmd
(windows) or terminal
(mac):
perl < clock.pl
The android clock will be instantly updated with your machine time.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With