In Javascript date object allows us to work with days, months, years, hours, minutes etc...
For displaying current date and time values create new Date object. The following sample displays the current system date and time values.
var dt=new Date();
alert(dt);

Creating a Date object with custom values:

You can create a Date time object in any of the following ways. The following code creates a date object with custom month, custom date and custom year.
var dt=new Date("10/24/2014");
//date must be specified in mm/dd/yyyy format only.
alert(dt);

Other way of creating date time object with custom values:

new Date(year, month, day, hours, minutes, seconds, milliseconds)

Other Date and time functions:

getDate:

this function returns date part of the date and time value present in date object.

Example:

The following code displays current system date value or day number.
var dt=new Date();
alert(dt.getDate());

getDay:

This function returns daynumber ( If the day name is Monday 1 will be returned, if the day name is Tuesday 2 will be returned back so on...)

Example:

The following code returns 3 since 8th October 2014 is Wednesday.
var dt=new Date("10/08/2014");
alert(dt.getDay());

getFullYear:

This function returns year number present in the current date object.
var dt = new Date("10/08/2014");
alert(dt.getFullYear());

getHours:

This function returns hours number present in the current date object.
var dt = new Date();
alert(dt.getHours());

Other date time methods:

MethodDescription
getMilliseconds
getMinutes
getMonth
getSeconds
getUTCDate
getUTCDay
setDate
setFullYear
setHours
setMilliseconds
setMinutes
setMonths