0

I've only found the reverse answer to this (normal date to yyyy-MM-dd'T'HH:mm:ss) but in my case, I have a string in a yyyy-MM-dd'T'HH:mm:ss format that I want to cast to date in order to display something like dd/MM/yyyy.

Does anybody have any idea? Thanks

GalloPinto
  • 667
  • 2
  • 11
  • 25

2 Answers2

2

I think below code is what you want. just try this.

var parsedDate = DateTime.parse('1974-03-20 00:00:00.000');
String formattedDate = DateFormat('dd/MM/yyyy').format(parsedDate);

Mahi
  • 1,297
  • 1
  • 14
  • 28
0

I will recommend you to look at the intl package