1

Flutter or kotlin or Java: How to change the current device date and time from my app. without going to device settings. My phone time is now 6:45 and I want to change it to 07:30. I can do it from settings but how I can do it from my flutter app. I saw other applications that make a shortcut to the time settings in the device. I hope that it is possible to change it directly from the flutter app or android studio. Thanks.

  • I think you have to write native code. Example: [like this in android](https://stackoverflow.com/questions/1332269/how-to-set-mobile-system-time-and-date-in-android) – selimdogan May 10 '22 at 08:24
  • What problem are you trying to solve? If you want to simulate different times for the purpose of testing, you can use [`package:fake_async`](https://pub.dev/packages/fake_async). It won't change the system time of the device, however. – jamesdlin May 10 '22 at 20:19

1 Answers1

0

if you want add 1 minute from current datetime

DateTime now = new DateTime.now();
var newNow = DateTime(now.year, now.month, now.day, now.hour, now.minute+1);
anggadaz
  • 342
  • 3
  • 13