I need a valid unix timestamp from javascript in a recent project. You just need to transform milliseconds to seconds with following call
Math.round(new Date().getTime()/1000)
I recommend to create a prototype on the date object.
This piece of code is valid for IE9+, Chrome, Firefox, Safari.