Convert Date to String Using Universal Time Convention

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

166 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() );          

Long Date D Format Specifier in C#

karthikeya Boyini
Updated on 23-Jun-2020 07:59:35

361 Views

The "D" format specifier represents a custom date and time format string.The format string is defined by culture's DateTimeFormatInfo.LongDatePattern property.The custom format string is −dddd, dd MMMM yyyyExample Live Demousing System; using System.Globalization; class Demo {    static void Main() {       DateTime myDate = new DateTime(2018, 9, 20);       Console.WriteLine(myDate.ToString("D", CultureInfo.CreateSpecificCulture("en-US")));    } }OutputThursday, September 20, 2018

LinkedList Contains Method in C#

Arjun Thakur
Updated on 23-Jun-2020 07:59:13

546 Views

Here is our LinkedList.int [] num = {1, 3, 7, 15}; LinkedList list = new LinkedList(num);To check whether the list contains an element or not, use the Contains() method. The following example checks for node 3 in the list.list.Contains(3)Above, returns True since the element is found as shown below −Example Live Demousing System; using System.Collections.Generic; class Demo {    static void Main() {       int [] num = {1, 3, 7, 15};       LinkedList list = new LinkedList(num);       foreach (var n in list) {          Console.WriteLine(n);       }   ... Read More

C Format Specifier for Currency

Samual Sam
Updated on 23-Jun-2020 07:58:36

32K+ Views

The "C" (or currency) format specifier is used to convert a number to a string representing a currency amount.Let us see an example.double value = 139.87;Now to display the above number until three decimal places, use (“C3”) currency format specifier.value.ToString("C3", CultureInfo.CurrentCulture)Let us see another example.Example Live Demousing System; using System.Globalization; class Demo {    static void Main() {       double value = 234.66;       // displays $       Console.WriteLine(value.ToString("C", CultureInfo.CurrentCulture));       Console.WriteLine(value.ToString("C3", CultureInfo.CurrentCulture));    } }Output$234.66 $234.660

Find Longest String from Array Using Lambda Expression in C#

Chandu yadav
Updated on 23-Jun-2020 07:56:57

992 Views

The following is our string array −string[] arr = { "Java", "HTML", "CSS", "JavaScript"};Use the Aggregate method and set a Lambda Expression to find the string with more number of characters.Here, the resultant string should have more number of characters than the initial seed value i.e. “jQuery” here.Example Live Demousing System; using System.Linq; class Demo {    static void Main() {       string[] arr = { "Java", "HTML", "CSS", "JavaScript"};       string res = arr.AsQueryable().Aggregate("jQuery", (longest, next) => next.Length >       longest.Length ? next : longest, str => str.ToLower());       Console.WriteLine("String with more ... Read More

Role of pageXOffset Property in JavaScript

Samual Sam
Updated on 23-Jun-2020 07:56:50

257 Views

If you want to get the pixels the document scrolled to from the upper left corner of the window, then use the pageXoffset and pageYoffset property. Use pageXoffset for horizontal pixels.ExampleYou can try to run the following code to learn how to work with pageXOffset property in JavaScript −Live Demo                    div {             background-color: green;             height: 1500px;             width: 1500px;          }                              function scrollFunc() {             window.scrollBy(200, 200);             alert("Horizonal: " + window.pageXOffset);          }             Scroll                      

Match Unicode Character Specified by Hexadecimal Number

Alankritha Ammu
Updated on 23-Jun-2020 07:56:14

331 Views

To match a Unicode character specified by the hexadecimal number xxx with JavaScript Regular Expression, use the following −\uxxxxExampleYou can try to run the following code to match the hexadecimal number character xxxx. It matches the hexadecimal number 53 i.e. S −           JavaScript Regular Expression                        var myStr = "Secure and Responsive!";          var reg = /\u0053/g;          var match = myStr.match(reg);                    document.write(match);          

Search a Hexadecimal Number Character Using JavaScript RegExp

Smita Kapse
Updated on 23-Jun-2020 07:55:32

402 Views

To find a hexadecimal number character with JavaScript Regular Expression, use the following. Add the hexadecimal number here −\xddExampleYou can try to run the following code to find hexadecimal number character. It searches for hexadecimal number 53 i.e. S −           JavaScript Regular Expression                        var myStr = "Secure and Responsive!";          var reg = /\x53/g;          var match = myStr.match(reg);                    document.write(match);          

Remove First Element from LinkedList in C#

karthikeya Boyini
Updated on 23-Jun-2020 07:55:13

533 Views

Let’s say the following is our LinkedList with integer nodes.int [] num = {29, 40, 67, 89, 198, 234}; LinkedList myList = new LinkedList(num);Now, if you want to remove the first element from the list, then use the RemoveFirst() method.myList.RemoveFirst();Example Live Demousing System; using System.Collections.Generic; class Demo {    static void Main() {       int [] num = {29, 40, 67, 89, 198, 234};       LinkedList myList = new LinkedList(num);       foreach (var n in myList) {          Console.WriteLine(n);       }       // removing first node       myList.RemoveFirst();       Console.WriteLine("LinkedList after removing the first node...");       foreach (var n in myList) {          Console.WriteLine(n);       }    } }Output29 40 67 89 198 234 LinkedList after removing the first node... 40 67 89 198 234

Convert Date to String Using Current Locale's Conventions

Manikanth Mani
Updated on 23-Jun-2020 07:54:51

208 Views

JavaScript date toLocaleString() method converts a date to a string, using the operating system's local conventions.The toLocaleString 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 learn how to convert a date to a string using current locale’s conventions −           JavaScript toLocaleString Method ... Read More

Advertisements