How to Get Current Date in Javascript
Posted on: February 17, 2021 by Ariessa Norramli
In this article, you will learn how to get the current date in Javascript.
Let’s say you have an empty variable named ‘a’.
var a;
In order to get the current date, you can use the new
keyword and Date
object.
var a = new Date();
console.log(a);
Note: The new
keyword functions by creating an instance of an object. The Date
object represents the date and time in a platform-independent format.
Share on social media
//