By using this :
Text(new DateTime.fromMillisecondsSinceEpoch(values[index]["start_time"]*1000).toString(),
I am getting the type of format attached in the picture, however I was wondering if I could get it in dd/MM/YYYY hh:mm
??
To format DateTime in Flutter using a standard format, you need to use the intl library and then use the named constructors from the DateFormat class. Simply write the named constructor and then call the format() method with providing the DateTime.
Flutter Convert TimeOfDay to 24 hours format | Technical Feeder. final time = TimeOfDay(hour: 21, minute: 12); time. toString(); // TimeOfDay(21:12) We expect that it returns hh:mm format but actually not.
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)));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With