flutter
Find number of days between two dates in Flutter or Dart
If you are using dates in your dart program and want to get the difference between them in terms of the number of days then you can use the methods explained in this post.
DateTime dateA = DateTime.parse('2021-08-19');
DateTime dateB = DateTime.parse('2021-09-27');
final numOfDays = dateB.difference(dateA).inDays;
print('$numOfDays');
Output
39
Was this helpful?
Similar Posts
- Add spacing between characters of Text widget Flutter
- Concatenate two list in Flutter
- Convert a double to an int in Dart or Flutter
- String to double conversion in flutter [Dart]
- Get current timestamp in flutter or dart
- Send HTTP Get request in Flutter or Dart
- Send HTTP POST request in Flutter or Dart