convert date to unix timestamp javascript

JavaScript
Math.round(new Date().getTime() / 1000).toString()new Date('2012.08.10').getTime() / 1000new Date('2012.08.10').getTime() / 1000 //secs
new Date('2012.08.10').getTime() //millisecondsvar unixTimestamp = moment('2012.08.10', 'YYYY.MM.DD').unix();
Source

Also in JavaScript: