flutter timeofday calculations

狂风中的少年 提交于 2019-12-24 05:46:10

问题


in my flutter app the user picks a time and I need to simply add some hours and minute to it to display the result. Is that easily possible? Unfortunately, there doesn't seem to be a function like TimeOfDay.add().

Any ideas?

Thanks!


回答1:


You can Use Date Time for that: You can add Minutes or Hours as you like.

TimeOfDay.fromDateTime(DateTime.now().add(Duration(hours: 2))); // result is 2hrs ahead of current time


来源:https://stackoverflow.com/questions/53015124/flutter-timeofday-calculations

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!