-1

I am developing a flutter news app. The format of date from Api response is ( 2021-02-05T09:41:13+0000 ) and I want to convert it to DD-MM-YYYY format. Can anybody help me with this?

2 Answers2

0

You can use this code :

final DateTime now = DateTime.now();
final DateFormat formatter = DateFormat('dd-MM-yyyy');
final String formatted = formatter.format(now);
return formatted;
Jay Dangar
  • 3,271
  • 1
  • 16
  • 35
0
String date = DateFormat.yMd().format('your date here');
Deepak Lohmod
  • 2,072
  • 2
  • 8
  • 18