This custom made function returns human readable formatted current date.
Function
function currentDate() { var today = new Date(); var dd = today.getDate(); var mm = today.getMonth() + 1; var yyyy = today.getFullYear(); if (dd < 10) { dd = '0' + dd; } if (mm < 10) { mm = '0' + mm; } return dd + '/' + mm + '/' + yyyy; }
Calling The Function
alert(currentDate());
Output
06/06/2018
Leave A comment
Email address is optional and will not be published. Only add email address if you want a reply from blog author.
Please fill required fields marked with *