Run ❯
Get your
own
website
Result Size:
625 x 565
×
Change Orientation
Save Code
Change Theme, Dark/Light
Go to Spaces
<!DOCTYPE html> <html> <body> <h2>JavaScript Dates</h2> <p>toLocaleTimeString() returns the time portion of a date, as a string, using locale conventions:</p> <p id="demo"></p> <script> const d = new Date(); let text = d.toLocaleTimeString(); document.getElementById("demo").innerHTML = text; </script> </body> </html>