Javascript Articles - Page 591 of 671

Set the full year for a specified date according to universal time.

Ramu Prasad
Updated on 23-Jun-2020 08:16:39

128 Views

JavaScript date setUTCFullYear() method sets the full year for a specified date according to universal time.The following are the parameters for setUTCFullYear(yearValue[, monthValue[, dayValue]]) −yearValue − An integer specifying the numeric value of the year, for example, 2008.monthValue − An integer between 0 and 11 representing the months January through December.dayValue − An integer between 1 and 31 representing the day of the month. If you specify the dayValue parameter, you must also specify the monthValue.ExampleYou can try to run the following code to set the full year for a specified date according to universal time −       ... Read More

Set the hour for a specified date according to universal time?

Jennifer Nicholas
Updated on 23-Jun-2020 08:15:29

138 Views

JavaScript date setUTCHours() method sets the hour for a specified date according to local time. The following is the parameter for setUTCHours(hoursValue[, minutesValue[, secondsValue[, msValue]]]) −hoursValue − An integer between 0 and 23, representing the hour.minutesValue − An integer between 0 and 59, representing the minutes.secondsValue − An integer between 0 and 59, representing the seconds. If you specify the secondsValue parameter, you must also specify the minutesValue.msValue − A number between 0 and 999, representing the milliseconds. If you specify the msValue parameter, you must also specify the minutesValue and secondsValue.ExampleYou can try to run the following code to ... Read More

How to get the number of the internet host port for the current page in JavaScript?

Shubham Vora
Updated on 12-Oct-2022 08:28:46

652 Views

In this tutorial, we will learn to get the number of internet host port for the current page in JavaScript. The Port number is a 16-bit unique ID of protocols. The port number ranged from 0-65535. The port number is used to find a process by the server. There are 65535, and each port number is associated with its identity. So, let us look to get the port number for the current page in JavaScript. Following are the methods by which we can get the port number of the internet host − Using the location.port Property Using the URL ... Read More

With JavaScript RegExp search a tab character.

Nikitha N
Updated on 23-Jun-2020 08:05:22

831 Views

To find a tab character with JavaScript Regular Expression, use the following −\tExampleYou can try to run the following code to find a tab character. It returns the position where the tab (\t) character is found −           JavaScript Regular Expression                        var myStr = "Simple \t Responsive!";          var reg = /\t/;          var match = myStr.search(reg);          document.write(match);          

Set the month for a specified date according to universal time.

Rishi Rathor
Updated on 23-Jun-2020 08:06:35

107 Views

JavaScript date setUTCMonth ( ) method sets the month for a specified date according to universal time.The following is the parameter of setUTCMonth ( monthvalue ) method in JavaScript −monthValue − An integer between 0 and 11, representing the month.ExampleYou can try to run the following code to set the month for a specified date according to universal time −           JavaScript getUTCSeconds Method                        var dt = new Date( "Aug 28, 2008 13:30:00" );          dt.setUTCMonth( 2 );                    document.write( dt );          

Set the minutes for a specified date according to universal time.

Alankritha Ammu
Updated on 23-Jun-2020 08:07:23

142 Views

JavaScript date setUTCMinutes() method sets the minutes for a specified date according to universal time.The following are the parameters for setUTCMinutes(minutesValue[, secondsValue[, msValue]]) method −minutesValue − An integer between 0 and 59, representing the minutes.secondsValue − An integer between 0 and 59, representing the seconds. If you specify the secondsValue parameter, you must also specify the minutesValue.msValue − A number between 0 and 999, representing the milliseconds. If you specify the msValue parameter, you must also specify the minutesValue and secondsValue.ExampleYou can try to run the following code to set the minutes for a specified date according to universal time ... Read More

How to load the previous URL in the history list in JavaScript?

Shubham Vora
Updated on 14-Sep-2022 13:33:47

6K+ Views

In this tutorial, we will learn to load the previous page in the history list in JavaScript. The Window object in JavaScript accesses the window in the browser. This object contains many properties and methods required to do the tasks. The Window object also retrieves the information from the browser window. There is a history stack in every browser that saves the pages visited by the user. To access this history stack, we can use the history object that is the property of the Window object. By accessing the history from the browser, we can go to the next or ... Read More

How to return a string representing the source for an equivalent Date object?

Daniol Thomas
Updated on 23-Jun-2020 08:07:54

115 Views

To return a string representing the source for an equivalent Date object, use the JavaScript toSource() method. This method returns a string representing the source code of the object.ExampleYou can try to run the following code to return a string representing the source for an equivalent Date object −           JavaScript toSource() Method                        var dt = new Date(2018, 0, 15, 14, 39, 7);          document.write( "Formated Date : " + dt.toSource() );          

How to return the "time" portion of the Date as a string using the current locale's conventions?

Priya Pallavi
Updated on 23-Jun-2020 08:09:03

114 Views

To return the "time" portion of the Date as a string, using the current locale's conventions, use the toLocaleTimeString() method.The toLocaleTimeString method relies on the underlying operating system in formatting dates. It converts the date to a string using the formatting convention of the operating system where the script is running. For example, in the United States, the month appears before the date (04/15/98), whereas in Germany, the date appears before the month (15.04.98).ExampleYou can try to run the following code to return the “time” portion of the Date as a string −           JavaScript toLocaleTimeString ... Read More

Set the seconds for a specified date according to universal time.

Rama Giri
Updated on 23-Jun-2020 08:08:31

142 Views

JavaScript date setUTCSeconds() method sets the seconds for a specified date according to universal time.The following are the parameters for setUTCSeconds(secondsValue[, msValue]) methodLsecondsValue − An integer between 0 and 59, representing the seconds.msValue − A number between 0 and 999, representing the milliseconds.ExampleYou can try to run the following code to set seconds for a specified date −           JavaScript setUTCSeconds Method                        var dt = new Date( "Aug 28, 2008 13:30:00" );          dt.setUTCSeconds( 65 );          document.write( dt );          

Advertisements