import 'package:intl/intl.dart'; class CustomDateFormatter { DateTime convertStringToDate(String datestring) { print("Date string : $datestring"); List datearray = datestring.split('/'); DateTime outputDate = DateTime(int.parse(datearray[2]), int.parse(datearray[0]), int.parse(datearray[1])); print("Output date : $outputDate"); return outputDate; } String formatDate() { final DateFormat formatter = DateFormat('yyyy-MM-dd hh:mm'); final String formatted = formatter.format(DateTime.now()); return formatted; } String formatYearDate(DateTime date) { final DateFormat formatter = DateFormat('yyyy-MM-dd'); final String formatted = formatter.format(date); return formatted; } }