Get current Date in Date / Month / Year format in JavaScript

JavaScript getting the current Date in DD/MM/YY format: Here, we are going to learn how to get the current date in JavaScript in Date / Month / Year format?
Submitted by IncludeHelp, on March 04, 2019

Getting current date in JavaScript

To get the current date in JavaScript, we need to use three library functions of Date class,

  1. Date getDate() Method – It returns current date (day of the month)
  2. Date getMonth() Method – It returns current month of the year
  3. Date getFullYear() Method – It returns current year in 4 digits format

Note: To call these functions, we need to create an object to the Date class using Date class constructor.


    Date class constructor:
    var dt = new Date();

    Function calls:

JavaScript code to get the current date in Date / Month / Year format

<head><title>JavaScipt Example</title></head>

	var dt = new Date(); //Date constructor 
	var dd = dt.getDate();
	var mm = dt.getMonth()+1;
	var yy = dt.getFullYear();
	//printing date
	document.write("Current date is= " + dd + "/" + mm + "/" + yy + "<br>");


Current date is= 4/3/2019

JavaScript Examples »

Related Examples

All JavaScript Examples

Comments and Discussions!

Load comments ↻

Copyright © 2024 All rights reserved.