Timestamps and formatting with Moment
Throughout the course we have used timestamps quite a bit, we've generated them in the to-do app and we also have them generated for all of our messages in the chat app, but we've never gone as far as formatting them to something human-readable. That's going to be the topic in this section, and in the next section we'll put that into action.
By the end of the next section we'll have a formatted message area with the name, timestamp and message, and we'll have some better styles for it as well. Now in this section, it's going to be all about time and timestamp, we're not going to make any changes to the frontend of our app, we're simply going to learn how time works inside of Node.
Timestamps in Node
To explore this we're going to create a new playground
file, over inside of Atom we're going to make a playground
folder to store this file, and inside of the playground
folder we can make a new file calling it time.js
. In here it will play around with time...