I want to show a countdown for an activity and it should show same value on each device. For this purpose I am trying to do the following:
- Store activity end time using
ServerValue.timestamp. - When a user joins activity, get current server time using
ServerValue.timestampand end time from firebase field. - Add the difference in current server time and end time to current time of the user to get user timezone specific end time.
Firstly I wanted to know if my logic is correct. Secondly, how do I add a duration to the server timestamp, for e.g. 60 seconds. In normal dateTime I think you can add duration using .add but couldn't find a method to do for server time. Thank you
I am using firebase_database package to connect to firebase.