I am trying to establish an era when data is being created in Firestore. I want to get a similar result in what is being done in a real-time database using ServerValue.TIMESTAMP .
I do not want to set it using the System.getCurrentMillis device time , because this time can be changed by the user.
According to the docs , an update is necessary, the problem with this is the format. This is my code:
Map<String, Object> map = new HashMap<>(); map.put("timestamp", FieldValue.serverTimestamp()); reference.update(map);
And this is the result in the Firebase web console:

I was very surprised that this is in Spanish, which may be useful in some situations, but the era is what I pursue. Try to see the bright side and stick to it and thought that I see the website in Spanish, so I changed the language in the footer selector, it has not changed. At this point, I assume that it is installed in the project language.
Let's get back to the attempt of the era. Given that my project uses the database in real time, I try to install it this way:
Map<String, Object> map = new HashMap<>(); map.put("timestamp", ServerValue.TIMESTAMP); reference.update(map);
He downloaded something, but it was just absurd.

I think that using the era, since the timestamp on the server side is the best standard approach, after that each client can convert it to the convenience and locale of the user.
Can the era be set as the server value in Firestore?
UPDATE
The answer, marked as correct, will lead me to some interesting conclusions that I would like to share, so it may be useful to others in the same situation:
- There is no need to set an era because of
FieldValue.serverTimestamp() it is a date object processed by the database, what we see on the console is just a friendly way to show this. - Since
FieldValue.serverTimestamp() is a date object, it can be sorted like any other timestamp if you add orderBy("timestamp", Query.Direction.DESCENDING) to your query (or Query.Direction.ASCENDING ), it sorts the results correctly. - And as for the @ 34m0 comment, thatโs right, clients donโt have to care about the logic for setting the creation time, but it should be done in Function.