Date Function in Javascript

1.create a date object and store it in a variable

var d= new Date();

 

2.Using the date object,Get the hour,minute,second,month,dayofmonth and year of the Current Date

var hour        = d.getHours();
var minute      = d.getMinutes();
var second      = d.getSeconds();
var month = d.getMonth();
var dayofmonth    = d.getDate();
var year        = d.getYear();

Example:-
Display Next Day of Today

function getNextDate()
{
var date= new Date();
var day = date.getDate();
var month = date.getMonth();
var year = date.getYear();
 
var nextdate= new Date(year, month, day +1);
var nxtDate=nextdate.getMonth()+1+"/"+nextdate.getDate()+"/"+NextDate.getYear();
document.getElementById('DisplaynextDate').value=nxtDate;
//Display Next Date(today+1)
}