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'];
});
});
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
Post a Comment