Welcome to the CSC Q&A.
Get help and give help!
Write great code!
It is our choices... that show what we truly are, far more than our abilities.


+9 votes

Does anyone know how to timestamp a string in firebase using React so it could be sorted a certain way?

asked in CSC490_Spring2019 by (-492 points)

1 Answer

+2 votes

If you specifically want to use a timestamp, then you could try getting the time from a Date object, then use that as the key when storing your value. When you write to Firebase it automatically sorts the items in a branch by their key.

Also, if you have children in Firebase that themselves have multiple children, you can use OrderByChild() to order what you read by a specific child. The link below is to some documentation that has the orderByChild() method listed.


answered by (8 points)

Thanks, I will try to do that!


Thanks, Imma try it out!