flutter TZDateTime to time string code example
Example 1: 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(); //"6:00 AM"
return format.format(dt);
}
Example 2: convert datetime to TZDateTimeflutter
var time = tz.TZDateTime.from(
scheduledNotificationDateTime,
tz.local,
);