Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

flutter

dart

My Date-Time format at the moment is this

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??

like image 297
heyr Avatar asked Jun 08 '18 09:06

heyr


People also ask

How do you convert DateTime to dd mm yyyy format in Flutter?

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.

How do you convert 12 hours to 24 hours in Flutter?

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.


1 Answers

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))); 
like image 150
vbandrade Avatar answered Sep 20 '22 15:09

vbandrade