Flutter How to format the date and time pull from the database

You can use this function for formatting your date

String formatDate(String dbDate){
  List<String> dateTimeList = dbDate.split(" ");
  List<String> dateList = dateTimeList.first.split("-");
  String dateTime = dateList[1]+"-"+dateList.last+"-"+dateList.first + " "+ dateTimeList.last;
  return dateTime;

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top