B
B
babbert2019-04-26 15:24:48
JavaScript
babbert, 2019-04-26 15:24:48

How to convert date in unix?

There is a date of this kind: Jul 6, 2015 at 11:12 PM
It needs to be converted to unix.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
0
0xD34F, 2019-04-26
@babbert

take moment.js and: moment(dateStr, 'MMM D, YYYY at hh:mm A').unix()
or, if you truncate the line, you can do without third-party libraries:
Date.parse(dateStr.replace('at', '')) / 1000

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question