I am working on test cases part, I wanted to check whether I am getting proper time from server even after changing time inside android device. For this I am using adb shell commands to overwrite date and time but this is not reflecting.
Calendar calendar = Calendar.getInstance();
calendar.setTimeInMillis(System.currentTimeMillis());
int date1 = calendar.get(Calendar.DATE);
getInstrumentation().getUiAutomation().executeShellCommand("date -s 07171010.00");
getInstrumentation().getUiAutomation().executeShellCommand("am broadcast -a android.intent.action.TIME_SET");
calendar.setTimeInMillis(System.currentTimeMillis());
int date2 = calendar.get(Calendar.DATE);