Firebase database.ServerValue.TIMESTAMP get current time

Firebase Server Time STAMP can only retive the value when it comminted to firebase database

var currentTimeStamp=firebase.database.ServerValue.TIMESTAMP;

value for this will be set when datbase operation like set ,push or update occures .

In order to get the value you need to write code like below.


  ref.child(test).child(time-stamp').set(firebaseAdmin.database.ServerValue.TIMESTAMP).then(function() {

                          ref.child(test).once('value').then(function(Snapshot) {
                         
                               var currentTimeStamp= Snapshot.val()['time-stamp'];

});
});

Comments

Popular posts from this blog

ENOENT: no such file or directory, rename : node_modules/async

react-quill Integrate quill-image-resize-module