JavaScript setHours()

The JavaScript date setHours() method sets the hour value for a particular date on the basis of local time. Syntax: dateObj.setHours(new_Hours); Parameters: new_Hours: Integer value between 0 to 23. Example: <!DOCTYPE html> <html> <body> <script> var bday =new Date(“November 16, 1994 21:00:10”); document.writeln(bday.getHours() + “<br>”); bday.setHours(12); document.writeln(bday.getHours()); </script> </body> </html>

JavaScript setFullYear()

The JavaScript date setFullYear() method sets the year value for the particular date on the basis of local time. Syntax: dateObj.setFullYear(new_year); Parameters: new_year: Integer value which represents a year. Example: <!DOCTYPE html> <html> <body> <script> var bday =new Date(“March 13, 1987 21:00:10”); document.writeln(bday.getFullYear() + “<br>”); bday.setFullYear(1988); document.writeln(bday.getFullYear()); </script> </body> </html>

JavaScript JS Date setDay()

The JavaScript date setDay() method sets the particular day of the week on the basis of local time. Syntax: dateObj.setDay(new_Day); Example: <!DOCTYPE html> <html> <body> <script> var date =new Date(“May 11, 2019 21:00:10”); document.writeln(date.getDate() + “<br>”); date.setDate(23); document.writeln(date.getDate()); </script> </body> </html>

JavaScript Date setDate()

The JavaScript date setDate() method sets the date value for a particular date on the basis of local time. Syntax: dateObj.setDate(new_Date); Parameters: new_Date: Integer value between 1 to 31. Example: <!DOCTYPE html> <html> <body> <script> var bday =new Date(“March 13, 1987 21:00:10”); document.writeln(bday.getDate() + “<br>”); bday.setDate(23); document.writeln(bday.getDate()); </script> </body> </html>

JavaScript Date getUTCSeconds()

The JavaScript date getUTCSeconds() method is used to get the integer value between 0 and 59 that represents the seconds on the basis of universal time. Syntax: dateObj.getUTCSeconds() Return: An integer value between 0 and 59. Example: <!DOCTYPE html> <html> <body> <script> var today = new Date(); document.writeln(today.getUTCSeconds()); </script> </body> </html>

JavaScript Date getUTCMonth()

The JavaScript date getUTCMonth() method is used to get the integer value between 0 and 11 that represents the month on the basis of universal time. Syntax: dateObj.getUTCMonth() Return: An integer value between 0 and 11. Example: <!DOCTYPE html> <html> <body> <script> var today = new Date(); document.writeln(today.getUTCMonth()+1); </script> </body> </html>

JavaScript Date getUTCMinutes()

The JavaScript date getUTCMinutes() method is used to get the integer value between 0 and 59 that represents the minutes on the basis of universal time. Syntax: dateObj.getUTCMinutes() Return: An integer value between 0 and 59. Example: <!DOCTYPE html> <html> <body> <script> var today = new Date(); document.writeln(today.getUTCMinutes()); </script> </body> </html>

JavaScript Date getUTCHours()

The JavaScript date getUTCHours() method is used to get the integer value between 0 and 23 that represents the hours on the basis of universal time. Syntax: dateObj.getUTCHours() Return: An integer value between 0 and 23. Example: <!DOCTYPE html> <html> <body> <script> var today = new Date(); document.writeln(today.getUTCHours()); </script> </body> </html>

JavaScript Date getUTCFullYear()

The JavaScript date getUTCFullYear() method is used to get the integer value that represents the year on the basis of universal time. Syntax: dateObj.getUTCFullYear() Return: An integer value that represents a year. Example: <!DOCTYPE html> <html> <body> <script> var today = new Date(); document.writeln(today.getUTCFullYear()); </script> </body> </html>

JavaScript Date getUTCDay()

The JavaScript date getUTCDay() method is used to get the integer value between 0 and 6 that represents the day of the week based on the universal time. Syntax: dateObj.getUTCDay() Return: An integer value between 0 and 6. Example: <!DOCTYPE html> <html> <body> <script> var a = [100,40,678,435,890]; var greatest = Math.max.apply(null, a); document.writeln(greatest); </script> … Read more