Get Firebase server time

10,172 views
Skip to first unread message

Zac Masinelli

unread,
Jun 5, 2016, 10:36:17 AM6/5/16
to Firebase Google Group
Hello team!

I'm developing an Android app, and trying to get the current Firebase server time (as opposed to a device's time, which could be wrong).

Is there a way to get the Firebase time? I couldn't find anything in the new (Google) documentation; the old (legacy) documentation mentioned "ServerValue.TIMESTAMP", but I couldn't seem to get that working either - but I may have been doing something wrong (namely, I wasn't sure which key/value to get from the timestamp).

If not, is there a lightweight library which gets server time that I could use in a production app?

Thanks!

Akshay Bora

unread,
Jun 5, 2016, 3:00:30 PM6/5/16
to Firebase Google Group
Hi,
You can use "ServerValue.TIMESTAMP" to get the current time in milliseconds from firebase server.
What problem you are facing in implementing this?
Regards,
Akshay

Chris Raynor

unread,
Jun 5, 2016, 8:04:59 PM6/5/16
to Firebase Google Group
In the new SDKs it's under firebase.database.ServerValue.TIMESTAMP: https://firebase.google.com/docs/reference/js/firebase.database#.ServerValue

--
You received this message because you are subscribed to the Google Groups "Firebase Google Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-tal...@googlegroups.com.
To post to this group, send email to fireba...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-talk/2133d310-4fb6-44fd-aed9-aac36dfe96c4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Michael Lehenbauer

unread,
Jun 6, 2016, 4:30:42 PM6/6/16
to Firebase Google Group

Joe White

unread,
Jun 6, 2016, 4:43:30 PM6/6/16
to Firebase Google Group

ServerValue

CONSTANT   STATIC

{TIMESTAMP: non-null Object}

A placeholder value for auto-populating the current timestamp (time since the Unix epoch, in milliseconds) as determined by the Firebase servers.

Reply all
Reply to author
Forward
0 new messages