0

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

2022-08-29T10:33:49.283Z

to

29/8
Digamber negi
  • 407
  • 1
  • 7
  • 20

2 Answers2

5

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);
linkkader
  • 155
  • 1
  • 9
2

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);
Afzal
  • 291
  • 3
  • 5