Can't set date via shell I've tried 

date -u 1407697765


output:

time 1407697765 -&gt; 1407697765.0
settimeofday failed Bad file number


and

busybox date -s @1407697765


output:

date: can't set date: Operation not permitted


I don't feel that I'm doing everything right (especially when date -u) but it looks like I have no permission... I'm trying it through adb shell

Why do I get these errors and how to set date through shell?
The following worked for me (once you have root permissions):

adb shell settings put global auto_time 0 &amp;&amp; adb shell date 010219302018.00 set &amp;&amp; adb shell am broadcast -a android.intent.action.TIME_SET


auto_time -> This is to switch off automatic syncing of time.

To reset the time back to syncing with the network, do:

adb shell settings put global auto_time 1 &amp;&amp; adb shell am broadcast -a android.intent.action.TIME_SET