I searched the documentation, Googled, and similar questions, but could not find a clear solution on how to get the server time, I need it to record the time of sending messages to Firestore.
Asked
Active
Viewed 170 times
-1
1 Answers
1
How to get the server time?
To be able to read a timestamp, you have to write it first and then read it back. This can be done using FieldValue.serverTimestamp(). In Java, you can simply do it using the solution from the following answer:
But it can simply be translated into Kotlin too.
Please also note that the Firebase server generates the timestamp. This is not generated on the client, but on the server.

Alex Mamo
- 130,605
- 17
- 163
- 193
-
Hey Danil. Can I help you with other information? – Alex Mamo Aug 12 '22 at 07:55
-
Yes I created new questions – Danil Aug 19 '22 at 06:05
-
Did my answer help? – Alex Mamo Aug 19 '22 at 06:26
-
Yes he helped me further develop the solution to the problem, but globally it remains unsolved – Danil Aug 20 '22 at 04:39