4

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.

Rakesh Patel
  • 1,673
  • 10
  • 27
  • Possible duplicate of [Trying to convert Firebase timestamp to NSDate in Swift](https://stackoverflow.com/questions/29243060/trying-to-convert-firebase-timestamp-to-nsdate-in-swift) – Jay Oct 24 '17 at 14:17

1 Answers1

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

mert dökümcü
  • 761
  • 3
  • 9
  • 31
  • 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. – Vatsal Shukla Sep 25 '18 at 05:22