
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 6710 Articles for Javascript

28K+ Views
In this tutorial, we will learn how to add 2 Hours to a JavaScript Date object. Here we will discuss two methods which are following. Using the getTime() Method Using the setHours() Method Using the getTime( ) Method JavaScript date getTime() method returns the numeric value corresponding to the time for the specified date according to universal time. The value returned by the getTime() method is the number of milliseconds since 1 January 1970 at 00:00:00. Syntax Following the syntax for the getTime() method − Date.getTime() Approach To add 2 hours to the Date Object first, we ... Read More

14K+ Views
In this tutorial, we will learn to convert the date to UTC. The full form of the UTC is the universal time coordinate, and it is a standard time that is considerable in every country. Let’s understand the need to convert the date to UTC by example. You have created the chat application. Users from various countries are using your application. Suppose that one user is from the USA and another from India. Both have a different time zone. So, you can either show the user to message received or send time in the local time or the UTC. There ... Read More

12K+ Views
In this tutorial, we will learn how to add 30 minutes to a JavaScript Date object. Here we will discuss two methods which are following. Using the setMinutes( ) Method Using the getTime() Method Using the setMinutes Method The setMinutes() function of the date object accepts an integer representing the Minutes and replaces the value of the Minutes in the current date with it. Syntax Date.setMinutes(min, sec, ms); Parameter min − An integer between 0 and 59, representing the minutes. sec − An integer between 0 and 59, representing the seconds. If you specify the sec ... Read More

3K+ Views
To get an only current year, use the JavaScript getFullYear() method. JavaScript date getFullYear() method returns the year of the specified date according to local time. The value returned by getFullYear() is an absolute number. For dates between the years 1000 and 9999, getFullYear() returns a four-digit number, for example, 2008.ExampleYou can try to run the following code to get a current year in JavaScript −Live Demo JavaScript getFullYear Method var dt = new Date("December 30, 2017 23:15:00"); document.write("getFullYear() : " + dt.getFullYear() ); OutputgetFullYear() : 2017

2K+ Views
The most common techniques for getting a day of the week and the name of the day in JavaScript will be covered in this tutorial. It is important to remember that if you are working on a small project, starting to install packages for something basic may be difficult. Small apps should be developed using JavaScript's built-in techniques; dependencies should only be included when absolutely necessary. Following are the approaches to get the day of the week in JavaScript − Using the getDay() Method Using the toLocaleString() Method Using the getDay() Method Use the JavaScript getDay() method ... Read More

6K+ Views
In this tutorial, we will learn how to find out the day of the month using JavaScript. We'll go over the most popular methods which are used for obtaining the name of the month and day in JavaScript. It is important that starting to install packages for something basic may be frustrating if you are working on a tiny project. JavaScript's built-in methods should be used to implement small applications; dependencies should only be added when absolutely necessary Using the getDate() Method A built-in data type for working with dates and times is the Date object. The new Date ... Read More

569 Views
To get current date and time using JavaScript, use the Date() method. JavaScript Date() method returns today's date and time and does not need any object to be called.ExampleYou can try to run the following code to get current date and time −Live Demo JavaScript Date Method var dt = Date(); document.write("Date and Time : " + dt ); OutputDate and Time : Mon May 28 2018 10:16:33 GMT+0530 (India Standard Time)

2K+ Views
We humans can understand how the date and time are divided and printed. On theother hand, JavaScript interprets the date based on a timestamp generated from Unix time, which is a value made up of milliseconds. JavaScript Platform-independent date objects represent a single point in time. A millisecond counter has been included in Date objects since January 1, 1970 UTC. YYYY-MM-DD is the most used JavaScript date format. Timed Dates YYYY-MM-D DTHH:MM:SSZ. A date data type is not available in JavaScript. Dates can be set, obtained, and changed using various methods provided on the Date object in JavaScript. In ... Read More

4K+ Views
To add new value to an existing array in Javascript, it can be achieved using various ways. We will be understanding seven different approaches for adding a new element to existing array. In this article we are having an array of numbers and our task is to add new value to an existing array in JavaScript. Approaches to Add New Value to Existing Array Here is a list of approaches to add new value to an existing array in JavaScript which we will be discussing in this article with stepwise explaination and complete example codes. ... Read More

3K+ Views
In this tutorial, we are going to learn to serialize JavaScript arrays. The serializeArray() method serializes all forms and forms elements like the .serialize() method but returns a JSON data structure for you to work with. A JavaScript array of objects may be created using the built-in jQuery function serializeArray() that is ready to be encoded as a JSON string. It utilizes a set of forms and/or form controls from jQuery. There are several sorts of controls. Any JavaScript object may be converted into JSON using a JSON string, which can then be sent to the server. Syntax Now let’s ... Read More