How to convert ISO8601 in flutter

Viewed 42

How to convert below ISO8601 format into just month and day.

2022-08-29T10:33:49.283Z

to

29/8
2 Answers

U can use package intl

Abr for the DateFormat class

final formatedDate = DateFormat('d/M').format(DateTime.now());
// ie: Prints 11/9(considering the date as today)
print(formatedDate);

you can use intl

DateTime now = DateTime.parse('2022-08-29T10:33:49.283Z');
var formatter =  DateFormat('dd/MM');
var formatted = formatter.format(now);
print(formatted);
Related