How to use ToLocaleTimeString in JavaScript
In this article I am going to explain about toLocaleTimeString() method in JavaScript.
JavaScript toLocaleTimeString() Method
JavaScript toLocaleTimeString() method use for get current time form date object and converts date into string format using local time conventions.
Syntax
Date.toLocaleTimeString()
|
Example
<html>
<head>
<script type="text/javascript">
function myfun() {
var dd = new Date();
var mm = document.getElementById("tst");
mm.innerHTML = dd.toLocaleTimeString();
}
</script>
</head>
<body>
<p>
click button to show Date</p>
<h1 id="tst" style="color: Blue">
</h1>
<button onclick="myfun()">
click me</button>
</body>
</html>
|
Output

You may also want to read these related articles: here
Ask Your Question
Got a programming related question? You may want to post your question here