I used ServerValue.TIMESTAMP to save the time in Firebase DB.
My code is
myRef.child(idna).child("msg_time").setValue(ServerValue.TIMESTAMP);
The value will be "msg_time": 1494779954547
First- Is it a correct way to save the time in Firebase ?
Second- How to convert it to readable date like dd-MM-yyyy HH:mm:ss
I tried:
Long timestamp =1494779904394;
SimpleDateFormat sfd = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss");
sfd.format(new Date(timestamp));
but it said Integer number too big.
any idea?
Firebase server timestamps are in milliseconds since epoch. You may need to divide by 1000 to get an accurate time if you aren't working with JavaScript.
--
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/30575b2d-6e67-434e-be1c-e4c71dc63a14%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.