You can achieve this by using the javascript function getTime().
Code:
var a = new Date();
alert(a.getTime());
According to getTime() definition:
The getTime() method returns the numeric value corresponding to the
time for the specified date according to universal time.
More can be found in this link
UPDATE:
If you want to have it in no of days then you would need to calculate it or use library like moment.js
5
solved Convert Date to number (not timestamp) in javascript