I stored the date in database as String and call it via model String? myDate;
, the data save as 31/12/2023 00:00:00
.
I want to dispaly in Text
widget as 31/12/2023
not 31/12/2023 00:00:00
so I tried to covnert String
to DateTime
then to String
again but the resutl is 2023-12-31 00:00:00.000
var date = '31/12/2023 00:00:00';
DateTime parseDate = intl.DateFormat("dd/MM/yyyy").parse(date);
var inputDate = DateTime.parse(parseDate.toString());
print(inputDate);
//output: 2023-12-31 00:00:00.000
How to achive my goal?