convert datetime to timeofday flutter code example
Example 1: flutter date time to timestamp
DateTime currentPhoneDate = DateTime.now();
Timestamp myTimeStamp = Timestamp.fromDate(currentPhoneDate);
DateTime myDateTime = myTimeStamp.toDate();
print("current phone data is: $currentPhoneDate");
print("current phone data is: $myDateTime");
Example 2: convert timeofday to string flutter
String formatTimeOfDay(TimeOfDay tod) {
final now = new DateTime.now();
final dt = DateTime(now.year, now.month, now.day, tod.hour, tod.minute);
final format = DateFormat.jm();
return format.format(dt);
}