Set DateTime via adb

suggest change

Default SET format is MMDDhhmm[[CC]YY][.ss], that’s (2 digits each)

For example, to set July 17’th 10:10am, without changing the current year, type:

adb shell 'date 07171010.00'

Tip 1: the date change will not be reflected immediately, and a noticable change will happen only after the system clock advances to the next minute. You can force an update by attaching a TIME_SET intent broadcast to your call, like that:

adb shell 'date 07171010.00 ; am broadcast -a android.intent.action.TIME_SET'

Tip 2: to synchronize Android’s clock with your local machine:

Linux:

adb shell date `date +%m%d%H%M%G.%S`

Windows (PowerShell):

$currentDate = Get-Date -Format "MMddHHmmyyyy.ss" # Android's preferred format
adb shell "date $currentDate"

Both tips together:

adb shell 'date `date +%m%d%H%M%G.%S` ; am broadcast -a android.intent.action.TIME_SET'

Default SET format is ‘YYYYMMDD.HHmmss’

adb shell 'date -s 20160117.095930'

Tip: to synchronize Android’s clock with your local (linux based) machine:

adb shell date -s `date +%G%m%d.%H%M%S`

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents