I am using Apollo Server, Graphql and Mongoose on my server and React on frontend. When I query "createdAt" in React I get a date with this format "1594321836292". I have found nothing to properly format this. Please help!
Asked
Active
Viewed 690 times
1 Answers
1
It's a unix timestamp. React or Apollo, or whatever is not involved here.
You can easily transform it to a JavaScript Date object:
new Date(1594321836292)
2020-07-09T19:10:36.292Z
Then having this object you can format it as you want using available methods.

keul
- 7,673
- 20
- 45
-
Thanks a lot Keul, it solved my problem. – Zia Jul 10 '20 at 18:34