Skip to content
Advertisement

How convert input type=”date” in a timestamp?

I need to convert an <input type="date"> value in a timestamp. This is my HTML code:

JavaScript

This field has a value that I have put like 25/10/2017

My jQuery code is:

JavaScript

But this is not working… why not?

Advertisement

Answer

make a new Date() passing the value of your input as parameter, then call getTime(). here an example:

JavaScript
JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement