1

I want to set server time in Firestore database in Long format. I have tried to create timestamp using below code, it seems like it creates just reference of the FieldValue.

val dataMap = HashMap<String, Any>()
dataMap["createdOn"] = FieldValue.serverTimestamp()

Is there any way to create server time and convert it into required format?

Jigar
  • 421
  • 2
  • 11
  • @Ashish It just shows FieldValue$ServerTimestampFieldValue@11736 – Jigar Aug 07 '19 at 10:21
  • @Alex: The output we try to achieve is get server time without saving into Firestore database. – Jigar Aug 07 '19 at 10:32
  • Check the second duplicate. – Alex Mamo Aug 07 '19 at 10:36
  • @AlexMamo: ServeValue has five options: SERVER_VALUE_UNSPECIFIED(0), REQUEST_TIME(1), UNRECOGNIZED(-1); SERVER_VALUE_UNSPECIFIED_VALUE REQUEST_TIME_VALUE But not able to find TIMESTAMP in it. – Jigar Aug 07 '19 at 10:41

0 Answers0