There's an easy way to convert a string from an input to a timestamp?
For example... I got this:
"5/4/2018 11:49:01"
how do I convert that to this format?
"1522928905"
There's an easy way to convert a string from an input to a timestamp?
For example... I got this:
"5/4/2018 11:49:01"
how do I convert that to this format?
"1522928905"
You can just use the getTime() function of the date object.
For example:
let date = new Date("5/4/2018 11:49:01");
console.log(date.getTime());
getTime() returns the time in milliseconds, if you want the time in seconds just divide the result with 1000.