Set Hour for a Specified Date According to Universal Time

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

146 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

C# Queryable Max Method

karthikeya Boyini
Updated on 23-Jun-2020 08:15:18

225 Views

Get the maximum value from a sequence using the Max() method.Let’s say the following is our list.List list = new List { 200, 400, 600, 800, 1000, 1200, 1400, 1600, 1800, 2000 };Use the Max() method to get the largest element.list.AsQueryable().Max();Example Live Demousing System; using System.Collections.Generic; using System.Linq; class Demo {    static void Main() {       List list = new List { 200, 400, 600, 800, 1000, 1200, 1400, 1600, 1800, 2000 };       foreach(long ele in list)       Console.WriteLine(ele);       // getting largest element       long max_num = list.AsQueryable().Max();       Console.WriteLine("Largest number = {0}", max_num);    } }Output200 400 600 800 1000 1200 1400 1600 1800 2000 Largest number = 2000

C# Queryable Min Method

Ankith Reddy
Updated on 23-Jun-2020 08:14:53

167 Views

Get the minimum value from a sequence using the Min() method in C#.The following is our list.List list = new List { 1, 2, 3, 4, 5, 6 };Now, use Queryable Min() method to get minimum element.list.AsQueryable().Min();Exampleusing System; using System.Collections.Generic; using System.Linq; class Demo {    static void Main() {       List list = new List { 1, 2, 3, 4, 5, 6 };       foreach(long ele in list) {          Console.WriteLine(ele);       }       // getting lowest element       long min_num = list.AsQueryable().Min();       Console.WriteLine("Smallest number = {0}", mix_num);    } }

Event Occurring When Dragged Element is Over Target in JavaScript

Paul Richard
Updated on 23-Jun-2020 08:14:21

411 Views

The ondragover event triggers when the dragged element is over the drop target.ExampleYou can try to run the following code to learn how to implement ondragover event in JavaScript −Live Demo                    .drag {             float: left;             width: 100px;             height: 35px;             border: 2px dashed #876587;             margin: 15px;             padding: 10px;          }   ... Read More

Remove Item from Hashtable in C#

Ankith Reddy
Updated on 23-Jun-2020 08:13:54

783 Views

The following is our Hashtable −Hashtable h = new Hashtable(); h.Add(1, "Jack"); h.Add(2, "Henry"); h.Add(3, "Ben"); h.Add(4, "Chris");To remove an item, use the Remove() method. Here, we are removing the 3rd element.h.Remove(3);Let us see the complete example.Example Live Demousing System; using System.Collections; public class Demo {    public static void Main() {       Hashtable h = new Hashtable();       h.Add(1, "Jack");       h.Add(2, "Henry");       h.Add(3, "Ben");       h.Add(4, "Chris");       Console.WriteLine("Initial list:");       foreach (var key in h.Keys ) {          Console.WriteLine("Key = ... Read More

Return Day of the Week for a Specified Date in Universal Time

Akshaya Akki
Updated on 23-Jun-2020 08:13:52

152 Views

JavaScript date getUTCDay() method returns the day of the week in the specified date according to universal time. The value returned by getUTCDay() is an integer corresponding to the day of the week: 0 for Sunday, 1 for Monday, 2 for Tuesday, and so on.ExampleYou can try to run the following code to return the day of the week in the specified date −           JavaScript getUTCDay Method                        var dt = new Date( "January 15, 2018 20:15:20" );          document.write("getUTCDay() : " + dt.getUTCDay() );          

Return Time Zone Offset in Minutes for Current Locale

Anvi Jain
Updated on 23-Jun-2020 08:13:23

293 Views

JavaScript date getTimezoneOffset() method returns the time-zone offset in minutes for the current locale. The time-zone offset is the minutes in difference; the Greenwich Mean Time (GMT) is relative to your local time.ExampleYou can try to run the following code to return the time-one offset in minutes −           JavaScript getTimezoneOffset Method                        var dt = new Date();          var tz = dt.getTimezoneOffset();                    document.write("getTimezoneOffset() : " + tz );          

C# Program to Find a Key in a Hashtable

karthikeya Boyini
Updated on 23-Jun-2020 08:13:17

477 Views

Set Hashtable collection with elements.Hashtable h = new Hashtable(); h.Add(1, "Jack"); h.Add(2, "Henry"); h.Add(3, "Ben"); h.Add(4, "Chris");Let’s say now you need to find any key, then use the Contains() method. We are finding key 3 here −h.Contains(3);The following is the complete example.Example Live Demousing System; using System.Collections; public class Demo {    public static void Main() {       Hashtable h = new Hashtable();       h.Add(1, "Jack");       h.Add(2, "Henry");       h.Add(3, "Ben");       h.Add(4, "Chris");       Console.WriteLine("Keys and Values list:");       foreach (var key in h.Keys ) ... Read More

C# Program to Find a Value in a Hashtable

George John
Updated on 23-Jun-2020 08:12:48

330 Views

Set Hahtable collection with elements.Hashtable h = new Hashtable(); h.Add(1, "Jack"); h.Add(2, "Henry"); h.Add(3, "Ben"); h.Add(4, "Chris");Let’s say now you need to find a value, then use the ContainsValue() method.We are finding value “Chris” here −h.ContainsValue(“Chris”);Example Live Demousing System; using System.Collections; public class Demo {    public static void Main() {       Hashtable h = new Hashtable();       h.Add(1, "Jack");       h.Add(2, "Henry");       h.Add(3, "Ben");       h.Add(4, "Chris");       Console.WriteLine("Keys and Values list:");       foreach (var key in h.Keys ) {          Console.WriteLine("Key ... Read More

Methods Supported by W3C DOM

Srinivas Gorla
Updated on 23-Jun-2020 08:12:46

160 Views

The following are the method supported by W3C DOM −Sr.NoProperty & Description1createAttribute( name)Returns a newly-created Attr node with the specified name.Ex − document.createAttribute( name)2createComment( text)Creates and returns a new Comment node containing the specified text.Ex − document.createComment( text)3createDocumentFragment( )Creates and returns an empty DocumentFragment node.Ex − document.createDocumentFragment( )4createElement( tagName)Creates and returns a new Element node with the specified tag name.Ex − document.createElement( tagName)5createTextNode( text)Creates and returns a new Text node that contains the specified text.Ex − document.createTextNode( text)6getElementById( id)Returns the Element of this document that has the specified value for its id attribute, or null if no such Element exists ... Read More

Advertisements