I have a time picker that returns the TimeOfDay object. But I have to save that value in a database as an integer of milliseconds which obtained from DateTime.millisecondsSinceEpoch. How can I achieve that?
This is not possible.
TimeOfDay
holds only the hour and minute. While a DateTime
also has day/month/year
If you want to convert it, you will need more information. Such as the current DateTime. And then merge the two into one final datetime.
TimeOfDay t;
final now = new DateTime.now();
return new DateTime(now.year, now.month, now.day, t.hour, t.minute);