current time in jquery code example
Example 1: javascript count time
var start = new Date().getTime();
for (i = 0; i < 50000; ++i) {
}
var end = new Date().getTime();
var time = end - start;
alert('Execution time: ' + time);
Example 2: how to get the computer date and time jquery
var now = new Date(Date.now());
var formatted = now.getHours() + ":" + now.getMinutes() + ":" + now.getSeconds();
Example 3: javascript current date time
var today = new Date().toLocaleDateString(undefined, {
day: '2-digit',
month: '2-digit',
year: 'numeric',
hour: '2-digit',
minute: '2-digit',
second: '2-digit'
})
Example 4: how to get the computer date and time jquery
var dt = new Date();
var time = dt.getHours() + ":" + dt.getMinutes() + ":" + dt.getSeconds();
document.write(time);
Example 5: how to get the computer date and time jquery
new Date($.now());