Date Time format in Flutter dd/MM/YYYY hh:mm

If you use the intl package

final f = new DateFormat('yyyy-MM-dd hh:mm');

Text(f.format(new DateTime.fromMillisecondsSinceEpoch(values[index]["start_time"]*1000)));

First install the pub.dev/packages/intl package in your pubspec.yaml

   intl: ^0.16.1

Then use

   final df = new DateFormat('dd-MM-yyyy hh:mm a');
   int myvalue = 1558432747;
   print(df.format(new DateTime.fromMillisecondsSinceEpoch(myvalue*1000)));

Output

21-05-2019 10:59 AM


You can use date_format plugin available here https://pub.dartlang.org/packages/date_format

Then to convert,

formatDate(DateTime.now(), [dd, '/', mm, '/', yyyy, ' ', HH, ':', nn])

Tags:

Dart

Flutter