1

in an Android app I have the following:

notebookRef = FirebaseFirestore.getInstance().collection("Registros");
notebookRef.add(new Lista(title, description, geoPoint, null));
Map<String, Object> value = new HashMap<>();
value.put("timestamp", ServerValue.TIMESTAMP);
notebookRef.add(value);

it go mad because instead of generating a timestamp it write the following in the firebase:

enter image description here

the server should generate its own timestamp: see here and here

what am I doing wrong?

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
user1616685
  • 1,310
  • 1
  • 15
  • 36
  • have a look at this - https://stackoverflow.com/questions/34718668/firebase-timestamp-to-date-and-time – Hades Oct 03 '18 at 23:46

1 Answers1

1

You're incorrectly using the ServerValue.TIMESTAMP from Realtime Database instead of FieldValue.serverTimestamp() for Firestore.

Doug Stevenson
  • 297,357
  • 32
  • 422
  • 441