The JavaScript Date function is used to return the Current Date and Time. In this article, we show you how to use the Date method with an example.
The following JS example helps you understand the date constructor to build a date from a custom date or return the current date and time with the time zone. To see all the built-in methods, visit the Date functions article.
<!DOCTYPE html>
<html>
<head>
<title> Sample </title>
</head>
<body>
<h1> Example </h1>
<script>
var dt = Date();
document.write("DateTime : " + dt);
</script>
</body>
</html>
Example
DateTime: The Nov 01 2018 11:32:39 GMT+0530 (Indian Standard Time)
Related Date functions