javascript display current time code example
Example 1: javascript get time
var time = new Date();
time.getDate();
time.getDay();
time.getFullYear();
time.getHours();
time.getMinutes();
time.getSeconds();
time.getMilliseconds();
time.getTime();
time.toDateString();
time.toLocaleString();
time.toLocaleTimeString();
time.toLocaleDateString();
Example 2: javascript get current time
var today = new Date();
var time = today.getHours() + ":" + today.getMinutes() + ":" + today.getSeconds();
Example 3: how to use current data in javascript
var today = new Date();
var date = today.getFullYear()+'-'+(today.getMonth()+1)+'-'+today.getDate();
Example 4: get current time in js
<script>
var today = new Date();
var time = today.getHours() + ":" + today.getMinutes() + ":" + today.getSeconds();
</script>
Example 5: calculate today date javascript
var today = new Date();
Example 6: get time in javascript
<a onclick="timeNow(test1)" href="#">SET TIME</a>
function timeNow(i) {
i.value = new Date()
}