Virat
Virat

Reputation: 581

Converting time-stamp to milliseconds in javascript

I have a date which is of format 20170622T164322Z. How to convert it into milliseconds(epoch time) in javascript. I am new to javascript, kindly help

Upvotes: 0

Views: 161

Answers (1)

Dat Nguyen
Dat Nguyen

Reputation: 1646

If you could use moment.js in your project, you can do this:

moment("20170622T164322Z").unix()

Example running on the console of the browser:

moment("20170622T164322Z").unix()
1498149802

Btw, moment.js is just great when dealing with date time.

Upvotes: 2

Related Questions