how to get the current time in js code example
Example 1: javascript get current time
var today = new Date();
var time = today.getHours() + ":" + today.getMinutes() + ":" + today.getSeconds();
Example 2: get current time in javascript
var d = new Date();
var n = d.toLocaleTimeString();
document.getElementById("timer").innnerHTML = n;
Example 3: current time in javascript
new Date().toLocaleString();
>> "09/08/2014, 2:35:56 AM"
Example 4: get current time in js
<script>
var today = new Date();
var time = today.getHours() + ":" + today.getMinutes() + ":" + today.getSeconds();
</script>
Example 5: javascript get current time
var date = new Date(Date.UTC(2012, 11, 20, 3, 0, 0));
console.log(date.toLocaleTimeString('en-US'));
console.log(date.toLocaleTimeString('en-GB'));