I am working on a firebase project and for displaying time regarding and entity, what i got is the timestamp. I am working on a react native project. How to convert the received timestamp to properly formatted date. This is the timestamp:
I have this time available in this.props.time
, and so i tried this.props.time.toDate()
but what i got was an error.
Invariant Violation:Objects are not valid as a React child(found: Tue Nov 26 2019 11:51:58 GMT+05:30(Indian Standard Time))
You can create a Date object with new Date(time.seconds * 1000 + time.nanoseconds/1000000)
then manipulate it the way you want.