get current date in javascript in dd/mm/yyyy format code example

Example 1: javascript date today dd mm yyyy

var today = new Date();
var dd = String(today.getDate()).padStart(2, '0');
var mm = String(today.getMonth() + 1).padStart(2, '0'); //January is 0!
var yyyy = today.getFullYear();

today = mm + '/' + dd + '/' + yyyy;
document.write(today);

Example 2: javascript date format mm/dd/yyyy

var date_format = new Date();

document.write(innerHTML = date_format.getMonth()+'/'+ date_format.getDate()+'/'+date_format.getFullYear());

Example 3: javascript get current date format dd mm yyyy hh mm ss

dformat = [d.getDate(), d.getMonth() + 1, d.getFullYear()].join('/') + ' ' + [d.getHours(),d.getMinutes(),d.getSeconds()].join(':');

Tags:

Java Example