I would like to be able to turn the automatic date time settings on and off from tasker. I don't see a way to do this directly but I can use tasker to issue a shell command. I know I can just use the date command to change the date to some specific date but is there a way to turn the automatic setting off and on from a command line or tasker?

  • If your problem is incorrect DST info - you can just update timezone database. Jun 21 '13 at 10:33

It might be useful to check the android source to find the exact package name to the system settings, specifically this source responsible for date/time, line 226 is the key!

Have played with tasker before, but can tasker directly modify system properties? as in directly do this, I am quoting line 228 the pertinent part:

        autoZoneEnabled ? 1 : 0);

In short the actual direct name to the package would be com.android.settings/.DateTimeSettings, if that's of any help!

By using adb shell's Android Activity Manager, am, one can start the activity to go directly into that screen as in am start -n com.android.settings/.DateTimeSettings, experiment and see if that fits your needs as I have not actually played with it. :)

  • There is also a Settings.Global.AUTO_TIME settings that you can also disable for auto date & time. Sep 5 '17 at 14:45
  • The setting wasn't working for me on Android10/Q but this method worked: stackoverflow.com/a/68055904/573377 DevicePolicyManager dpm = (DevicePolicyManager) getApplicationContext().getSystemService(Context.DEVICE_POLICY_SERVICE); ComponentName component = new ComponentName(getApplicationContext(), DeviceAdminReceiver.class); dpm.setGlobalSetting(component, Settings.Global.AUTO_TIME, enable ? "1" : "0");
    – jeoffman
    Aug 4 '21 at 18:41

turn on:

settings put global auto_time 1

turn off:

settings put global auto_time 0

source: Android sourcecode

  • An example using ADB would be: $ adb shell settings put global auto_time 1 Mar 31 '21 at 23:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.