2

I would like to know how can i use the current timeStamp provided by firebase on a firebase query, for example :

ref.orderByChild('locationAt').endAt("firebase timeStamp here").once("value", function(snapshot){
... });

Alex Mamo
  • 130,605
  • 17
  • 163
  • 193
The Cshe
  • 21
  • 2
  • Why would you have a time stamp in a locationAt child node? And [this question](http://stackoverflow.com/questions/43203910/how-to-create-negative-firebase-timestamp-in-swift/43379902#43379902) has a Swift 3 answer that may provide some additional info. – Jay May 19 '17 at 18:48
  • the "locationAt" is a collection that contain a timeStamp value, i use this query to return values when timeStamp within locationAt inferior of the current firebase timeStamp, i tried to get firebase timeStamp with this commande ( firebase.database.ServerValue.TIMESTAMP ) and i put it in the query but doesn't work !! – The Cshe May 19 '17 at 19:39
  • The Firebase timestamp isn't really designed to work like that. It's a server side function that can be used to write the current timestamp to a node (for example). If you want to read it and use in code, attach an observer to a timestamp node, write the timestamp to Firebase which to which the observer will read it back in. See [this question](http://stackoverflow.com/questions/43033453/how-to-get-firebase-database-servervalue-timestamp-on-update-operation) and [another question](http://stackoverflow.com/questions/40214593/firebase-database-servervalue-timestamp-return-an-object) – Jay May 19 '17 at 20:08

0 Answers0