Found 448 Articles for Programming Scripts

With JavaScript RegExp search a tab character.

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

625 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

50 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

76 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 return a string representing the source for an equivalent Date object?

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

58 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

62 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

88 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 );          

How to define a Regular Expression in JavaScript?

Sravani S
Updated on 19-May-2020 11:07:45

99 Views

A regular expression is an object that describes a pattern of characters.The JavaScript RegExp class represents regular expressions, and both String and RegExp define methods that use regular expressions to perform powerful pattern-matching and search-and-replace functions on the text. A regular expression could be defined with the RegExp () constructor, as follows −var pattern = new RegExp(pattern, attributes); or var pattern = /pattern/attributes;The following are the parameters −pattern − A string that specifies the pattern of the regular expression or another regular expression.attributes − An optional string containing any of the "g", "i", and "m" attributes that specify ... Read More

How to convert a date to a string using the universal time convention?

Nancy Den
Updated on 23-Jun-2020 07:59:39

102 Views

To convert a date to a string using the universal time convention, use the toUTCString() method. It returns converted the date to a string, using the universal time convention.ExampleYou can try to run the following code to learn how to convert a date to a string using UTC −           JavaScript toUTCString Method                        var dateobject = new Date(2018, 0, 15, 14, 39, 7);          document.write( dateobject.toUTCString() );          

How to return the "time" portion of the Date as a human-readable string.

Sai Nath
Updated on 23-Jun-2020 08:00:07

55 Views

To return the “time” portion of the Date as a human-readable string, use the toTimeString() method in JavaScript. This method returns the time portion of a Date object in the human-readable form.ExampleYou need to run the following code to return only the time portion of a Date −           JavaScript toTimeString Method                        var dateobject = new Date(2018, 0, 1, 14, 39, 7);          document.write( dateobject.toTimeString() );          

What is the role of ignoring Case RegExp property in JavaScript?

Abhinanda Shri
Updated on 19-May-2020 11:06:36

39 Views

ignoreCase is a read-only boolean property of RegExp objects. It specifies whether a particular regular expression performs case-insensitive matching, i.e., whether it was created with the "i" attribute.ExampleYou can try to run the following code to learn how to work with Ignore Case RegExp property in JavaScript.           JavaScript RegExp ignoreCase Property                        var re = new RegExp( "string" );          if ( re.ignoreCase ) {             document.write("Test1-ignoreCase property is set");          } ... Read More

Advertisements