current formatted date dd/mm/yyyy

In this post we show you how current formatted date dd/mm/yyyy. By using Date() function we get current date and convert in to dd/mm/yyyy.

// use Date() function for current get date
var todays_date = new Date();
// get date from
var dd = todays_date.getDate();
// get month
// January come as 0 so we increase it with 1
var mm = todays_date.getMonth()+1;
// get year
var yyyy = todays_date.getFullYear();
// if date is less than 10 so we concat with 0
if(dd < 10)
{
dd ='0' + dd
}
// if month is less than 10 so we concat with 0
if(mm < 10)
{
mm='0' + mm
}
var todays_date = dd+'/'+mm+'/'+yyyy;
alert(today);

Leave a Comment

Your email address will not be published. Required fields are marked *

9  +  1  =  

We accept paid advance and paid guest Posting on our Site : Contact US