ES6 - Date

The Date object is a datatype built into the JavaScript language. Date objects are created with the new Date () as shown in the following syntax.
Once a Date object is created, a number of methods allow you to operate on it. Most methods simply allow you to get and set the year, month, day, hour, minute, second, and millisecond fields of the object, using either local time or UTC (universal, or GMT) time.
The ECMAScript standard requires the Date object to be able to represent any date and time, to millisecond precision, within 100 million days before or after 1/1/1970. This is a range of plus or minus 273,785 years, so JavaScript can represent date and time till the year 275755.
You can use any of the following syntax to create a Date object using Date () constructor.
new Date( ) 
new Date(milliseconds) 
new Date(datestring) 
new Date(year,month,date[,hour,minute,second,millisecond ])

Note − Parameters in the brackets are always optional.
Here is a list of the properties of the Date object along with their description.
Specifies the function that creates an object's prototype
The prototype property allows you to add properties and methods to an object
Following is a list of different date methods along with the description.
Returns today's date and time
Returns the day of the month for the specified date according to the local time
Returns the day of the week for the specified date according to the local time
Returns the year of the specified date according to the local time
Returns the hour in the specified date according to the local time
Returns the milliseconds in the specified date according to the local time
Returns the minutes in the specified date according to the local time
Returns the month in the specified date according to the local time
Returns the seconds in the specified date according to the local time
Returns the numeric value of the specified date as the number of milliseconds since January 1, 1970, 00:00:00 UTC
Returns the time-zone offset in minutes for the current locale
Returns the day (date) of the month in the specified date according to the universal time
Returns the day of the week in the specified date according to the universal time
Returns the year in the specified date according to the universal time
Returns the hours in the specified date according to the universal time
Returns the milliseconds in the specified date according to the universal time
Returns the minutes in the specified date according to the universal time
Returns the month in the specified date according to the universal time
Returns the seconds in the specified date according to the universal time
Sets the day of the month for a specified date according to the local time
Sets the full year for a specified date according to the local time
Sets the hours for a specified date according to the local time
Sets the milliseconds for a specified date according to the local time
Sets the minutes for a specified date according to the local time
Sets the month for a specified date according to the local time
Sets the seconds for a specified date according to the local time
Sets the Date object to the time represented by a number of milliseconds since January 1, 1970, 00:00:00 UTC
Sets the Date object to the time represented by a number of milliseconds since January 1, 1970, 00:00:00 UTC
Sets the full year for a specified date according to the universal time
Sets the hour for a specified date according to the universal time
Sets the milliseconds for a specified date according to the universal time
Sets the minutes for a specified date according to the universal time
Sets the month for a specified date according to the universal time
Sets the seconds for a specified date according to the universal time
Returns the "date" portion of the Date as a human-readable string
Returns the "date" portion of the Date as a string, using the current locale's conventions
Converts a date to a string, using the current locale's conventions
Returns the "time" portion of the Date as a string, using the current locale's conventions
Returns a string representing the specified Date object
Returns the "time" portion of the Date as a human-readable string
Converts a date to a string, using the universal time convention
Returns the primitive value of a Date object

    32 Lectures 
     3.5 hours 

 Sharad Kumar

    40 Lectures 
     5 hours 

 Richa Maheshwari

    16 Lectures 
     1 hours 

 Anadi Sharma

    50 Lectures 
     6.5 hours 

 Gowthami Swarna

    14 Lectures 
     1 hours 

 Deepti Trivedi

    31 Lectures 
     1.5 hours 

 Shweta
 Print
 Add Notes
 Bookmark this page