this is working Because String
TimeUtils.convertddMMMyy(
DateTime.parse(lowprice.paidOn!)
),
static String convertddMMMyy(DateTime date) {
final DateTime dateTime = date;
final DateFormat formatter = DateFormat('yyyy-MMM-dd');
final String formattedDate = formatter.format(dateTime);
return formattedDate;
I need for a list , like below
CustomText(
List[index].paidOn,
color: ColorResource.appBarTextColor, ),
so how to change dateformat in list for flutter ? now its giving 01-03-2022 i need 01-mar-2022
CodePudding user response:
Did you tried this way?
convertDateFormat(lowprice.dateFrom!, "dd-MMM-yyyy")
//
String convertDateFormat(String date, String new_format) {
DateTime dateTime = DateTime.parse(date);
return DateFormat(new_format).format(dateTime);
}
CodePudding user response:
**its working now**
CustomText(
TimeUtils.convertddMMMyy(
DateTime.parse(List[index].paidOn!)),
color: ColorResource.appBarTextColor,
),