ServerValue.TIMESTAMP returns 2 values?

I use the following code to add a timestamp to a post:

Map<String, Object> postValues = post.toMap(); postValues.put("timeStamp", ServerValue.TIMESTAMP); 

On the client side, two timestamp values ​​are printed (one for the local creation date and one for the value from the server that I think). How to print only the value received from the server?

Side note for Frank: The code below is called when the user clicks the submit button. This way messageViewHolder is updated twice in my application (see related question ). ViewHolder is updated once with a local time estimate and once with a time server. I want him to update the holder only using server time (once) for practical purposes.

 FriendlyMessage friendlyMessage = new FriendlyMessage("bla","bla","bla"); String key = mFirebaseDatabaseReference.child(MESSAGES_CHILD).push().getKey(); Map<String, Object> postValues = friendlyMessage.toMap(); postValues.put("creationDate", ServerValue.TIMESTAMP); childUpdates.put("/"+MESSAGES_CHILD+"/" + key, postValues); Map<String, Object> childUpdates = new HashMap<>(); mFirebaseDatabaseReference.updateChildren(childUpdates); 
0
java android firebase firebase-database
source share

No one has answered this question yet.

See similar questions:

eleven
How to use a Firebase server timestamp to create a date?
7
Only populate viewHolder with messages retrieved from the database?
0
Add a child using Cloud features?

or similar:

6170
Is Java "pass-by-reference" or "pass-by-value"?
2171
How to determine if an array contains a specific value in Java?
1818
How to get enum value from string value in Java?
1544
Sort map <Key, value> by value
1492
Does Java support default parameter values?
935
Cannot start Eclipse - Java was started, but returned exit code = 13
eleven
How to use a Firebase server timestamp to create a date?
4
Using Firebase server timestamp to create a synchronized countdown timer on Android
2
Firebase onDataChanged fires twice when using ServerValue.TIMESTAMP (Android)
-2
getting firebase ServerValue.TimeSTAMP in the wrong format, how to convert to Date?

All Articles