36417

Swift 4: Firebase Timestamp

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

<strong>Edit:</strong> 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.

Answer1:

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

Recommend

  • DB-ref in mongoose without Schema.ObjectId?
  • syntax for linking documents in mongodb
  • Resolve DBRef into Json
  • How do I make a function return data that was set within function (child snapshot) in firebase
  • Cross Platform way to get the time of day?
  • Run-time check Failure #2 , while using API for saving image frame
  • Problems with python 2.4 and 2.4.4 in struct.unpack and win/lin
  • Alarm Manager broadcasts unexpectedly
  • Firebase: Get reference to first item/element
  • Twitter json API foreign characters
  • Using BOOST_FOREACH with a constant intrusive list
  • Unable to run app-client that is accessing an EJB on GlassFish v3
  • Entire JSON into One SQLite Field with Python
  • Low TTL with Leveled Compaction, should I reduce gc_grace_seconds to improve read performance withou
  • Redux Form - Not able to type anything in input
  • print() is showing quotation marks in results
  • Make VS2015 use angular-cli ng at build time in a .NET project
  • Row Count Is Returning the incorrect number using RaptureXML
  • Android fill_parent issue
  • Pass value from viewmodel to script in zk
  • Illegal mix of collations for operation for date/time comparison
  • Why ng-show works with ng-repeat but ng-if doesn't? [duplicate]
  • Optimizing database types to compact database (SQLite)
  • How do I fake an specific browser client when using Java's Net library?
  • Get object from AWS S3 as a stream
  • Release, debug version and Authorization Google?
  • Alternatives to the OPTIONAL fallback SPARQL pattern?
  • Do I've to free mysql result after storing it?
  • QuartzCore.framework for Mono Develop
  • Python - Map / Reduce - How do I read JSON specific field in using DISCO count words example
  • Warning: Can't call setState (or forceUpdate) on an unmounted component
  • Traverse Array and Display in markup
  • bootstrap to use multiple ng-app
  • using conditional logic : check if record exists; if it does, update it, if not, create it
  • How to get icons for entities from eclipse?
  • Hits per day in Google Big Query
  • Turn off referential integrity in Derby? is it possible?
  • How can I remove ASP.NET Designer.cs files?
  • JaxB to read class hierarchy
  • java string with new operator and a literal