i want to print the Time that i initialized manually but if i print it then i only get this here.
I/flutter (14375): TimeOfDay(15:00)
Here is my Code
Future<void> ausgabe(BuildContext context) async {
Map<String, TimeOfDay> zeiten = {"Montag": TimeOfDay(hour: 15, minute: 0)};
print(zeiten["Montag"]);
}
How can i only print 15:00 instead of TimeOfDay(15:00)?
You can either use:
TimeOfDay time = TimeOfDay(hour: 15, minute: 0);
print(time.format(context));
Or you can do that with DateFormat
from the intl flutter package.
print(DateFormat("HH:mm").format(new DateTime(
2000,
1,
1,
time.hour,
time.minute)))