Reputation: 700
I have a weight diary where the user can daily add his weight. So now i want to show it in a line chart but i need to create a list with the dates. Is there a way to create something like this? For example the first date should be the 6th april. How to create a list where every date is listed in the right format?
Upvotes: 1
Views: 315
Reputation: 41
You can create a list of DateTime objects and then add the diary dates to that list. It would be something like this:
List<DateTime> diaryDates = [];
//use split to remove the timestamps
diaryDates.add(date.toLocal().split('')[0]);
Upvotes: 1