I have a string showing the date and time, but I only want to see the hour and minute. how do i do this with flutter.Sorry if there are other questions that I missed.
String? time = "2023-02-21 14:50:40";
Result:
String? time = "14:50";
I tried to try with regex but failed
2
Answers
I think the quickest way is using the built-in
DateTime.parse()
:You can use intl package for convert
string
todatetime
.