5

How should i compare Firebase Timestamp with local device time.

let serverTIme = FIRServerValue.timestamp() let localtime = Date() let dbRef = FirebaseServerReference() 

here is full code https://pastebin.com/4drtSZA6

Edit:
When i set timestamp in Firebase RealtimeDatabase using FIRServerValue.timestamp it suppose to save timestamp of Server not the my device time.
In my case, it looks like it is depending on my device time. i want to check that if there is a ‘Time Difference’ in server time & my device time.
So i think that this question might not possible duplicate of Trying to convert Firebase timestamp to NSDate in Swift.

1

1 Answer 1

1

You can convert Firebase timestamp to NSDate and then compare Date() later on. Here is a similar question and a possible solution: Trying to convert Firebase timestamp to NSDate in Swift

Sign up to request clarification or add additional context in comments.

1 Comment

when you change your device time then the timestamp will be same on firebase. it will be useless when device time is not accurate/true.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.