Even though there's already an accepted answer, I thought this one was good to share.
const timeInSeconds = new Date.getTime() / 1000 | 0;
This works because bitwise operations on floats converts them to 32 bit integers; thus, truncating the decimal part.