In JavaScript how to get second of current day?

javascript, seconds, time

Solution

You add up the bits:

var dt = new Date();
var secs = dt.getSeconds() + (60 * dt.getMinutes()) + (60 * 60 * dt.getHours());

or if you prefer

var dt = new Date();
var secs = dt.getSeconds() + (60 * (dt.getMinutes() + (60 * dt.getHours())));

Problem

So the question is described in title. I need to get current second of the day using JavaScript.

Original source