Local time and local date : Date Get « Date Time « JavaScript DHTML






Local time and local date

 

<html>
<head>
    <title>the date</title>
</head>
<body>
    <p id="dateField">&nbsp;</p>
    <script type = "text/javascript">

    var myDate = new Date();
    var dateString = myDate.toLocaleDateString() + " " + myDate.toLocaleTimeString();
    var dateLoc = document.getElementById("dateField");
    dateLoc.innerHTML = "Now: " + dateString;
    </script>

</body>
</html>

   
  








Related examples in the same category

1.Get Day
2.Get Seconds
3.Get Month
4.Get Milliseconds
5.Get Full Year
6.Get Year
7.Get Time
8.To Date Source
9.Convert Date to Locale String()
10.Value Of a Date
11.Readable date value
12.Output date and time in a human readble form
13.Make the time readable
14.Use toPrecision to set the date precision