How to get current time with jQuery

Relm picture Relm · Dec 8, 2013 · Viewed 518.6k times · Source

The following returns time in microseconds, for example 4565212462.

alert( $.now() );

How do I convert it to a human readable time format, such as (hours:minutes:seconds)?

Answer

Rahul Tripathi picture Rahul Tripathi · Dec 8, 2013

You may try like this:

new Date($.now());

Also using Javascript you can do like this:

var dt = new Date();
var time = dt.getHours() + ":" + dt.getMinutes() + ":" + dt.getSeconds();
document.write(time);