JavaScript setUTCHours()

The JavaScript date setUTCHours() method sets the hour value for a particular date on the basis of universal time. Syntax: dateObj.setUTCHours(new_hours); Parameters: new_hours: Integer value between 0 to 23. Example: <!DOCTYPE html> <html> <body> <script> var today =new Date(); document.writeln(today.getUTCHours()+”<br>”); today.setUTCHours(12); document.writeln(today.getUTCHours()); </script> </body> </html>

JavaScript setUTCFullYear()

The JavaScript date setUTCFullYear() method sets the year value for the particular date on the basis of universal time. Syntax: dateObj.setUTCFullYear(new_years); Parameters: new_years: Integer value which represents a year. Example: <!DOCTYPE html> <html> <body> <script> var today =new Date(); document.writeln(today.getUTCFullYear()+”<br>”); today.setUTCFullYear(2019); document.writeln(today.getUTCFullYear()); </script> </body> </html>

JavaScript setUTCDate()

The JavaScript date setUTCDate() method sets the date value for a particular date on the basis of universal time. Syntax: dateObj.setUTCDate(new_date); Parameters: new_Date: Integer value between 1 to 31. Example: <!DOCTYPE html> <html> <body> <script> var today =new Date(); document.writeln(today.getUTCDate()+”<br>”); today.setUTCDate(31); document.writeln(today.getUTCDate()); </script> </body> </html>

JavaScript setSeconds()

The JavaScript date setSeconds() method sets the second value for the particular date on the basis of local time. Syntax: dateObj.setSeconds(new_seconds); Parameters: new_seconds: Integer value between 0 to 59. Example: <!DOCTYPE html> <html> <body> <script> var bday =new Date(“November 16, 1994 21:00:50”); document.writeln(bday.getSeconds() + “<br>”); bday.setSeconds(45); document.writeln(bday.getSeconds()); </script> </body> </html>

JavaScript setMonth()

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

JavaScript setMinutes()

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

JavaScript setMilliseconds()

The JavaScript date setMilliseconds() method sets the millisecond value for a particular date on the basis of local time. Syntax: dateObj.setMilliseconds(new_milliseconds); Parameters: new_milliseconds: Integer value between 0 to 999. If its value is greater than 999 then the second value will be increased accordingly. Example: <!DOCTYPE html> <html> <body> <script> var bday =new Date(“November 16, … Read more

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>