How to return the current timestamp with Moment.js?

Sometimes, we want to return the current timestamp with Moment.js.

In this article, we’ll look at how to return the current timestamp with Moment.js.

How to return the current timestamp with Moment.js?

To return the current timestamp with Moment.js, we can use the unix method.

For instance, we write

const currentDate = moment().unix();

to return the current UNIX timestamp.

Conclusion

To return the current timestamp with Moment.js, we can use the unix method.