How to convert my date to timestamp i dont know where im doing wrong.Any suggestion please ?
var dates = '27-04-2015';
var date1 = new Date(dates).getTime();
alert(date1);
Parameter you passed in the new Date('27-04-2015') is not valid. Use sepeartor '/' for change date format and send to the new Date('27/04/2015').
var dates = '27-04-2015';
var dates1 = dates.split("-");
var newDate = dates1[1]+"/"+dates1[0]+"/"+dates1[2];
alert(new Date(newDate).getTime());
Working Fiddle
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With