skip to Main Content

How can I write and read Flutter’s TimeOfDay value in Firestore?
TimeOfDay is a value representing a time during the day, independent of the date that day might fall on or the time zone.

Should I convert it to a string ("13:30")?

2

Answers


  1. The best option that you have is to save the date and time as a Timestamp:

    A Timestamp represents a point in time independent of any time zone or calendar, represented as seconds and fractions of seconds at nanosecond resolution in UTC Epoch time.

    If you only need to use the time, then you can simply get it out by calling toDate. Inside the DateTime class you’ll find two useful properties hour and minute.

    Login or Signup to reply.
  2. You can convert TimeOfDay to DateTime then to store DateTime.toIsoString..()

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search