I have a Date time string 2021-12-12T11:11:00. I want to remove the substring T11:11:00, so that I am left with 2021-12-12.
Does anyone have any ideas? Please help me.
I have a Date time string 2021-12-12T11:11:00. I want to remove the substring T11:11:00, so that I am left with 2021-12-12.
Does anyone have any ideas? Please help me.
import 'package:intl/intl.dart'; //note --->>> import package
DateTime parsedDateTime = DateTime.parse('2021-12-12T11:11:00');
String formatDate = DateFormat("yyyy-MM-dd").format(parsedDateTime);
OUTPUT ->
2021-12-12
String _date_and_time = "2021-12-12T11:11:00";
String date = _date_and_time.split("T")[0];
print("Date is : ${date}");