JavaScript Date setTime() Function Last Updated : 23 Jul, 2025 Comments Improve Suggest changes Like Article Like Report The JavaScript Date setTime() Function is a built-in Function in Javascript that is used to get a date object by adding given milliseconds to the date 01/01/1970 Syntax: date.setTime(milliseconds) Parameters: setTime() Function takes parameters as follows. milliseconds: Number of milliseconds to add/subtract to the given date Return Value: The setTime() Function returns milliseconds between January 1 1970 and the time you passed in the parameter. Example 1: Adding 300000000000 milliseconds to 01/01/1970 JavaScript <script> // Initialization let date = new Date(); // Execution let output = date.setTime(300000000000); // Display Output console.log(`setTime() Output:`, output, date); </script> Output: setTime() Output: 300000000000 Thu Jul 05 1979 10:50:00 GMT+0530 (India Standard Time) Example 2: Subtracting 300000000000 milliseconds to 01/01/1970. JavaScript <script> // Initialization let date = new Date(); // Execution let output = date.setTime(-300000000000); // Display Output console.log(`setTime() Output:`, output, date); </script> Output: setTime() Output: -300000000000 Thu Jun 30 1960 00:10:00 GMT+0530 (India Standard Time) We have a complete list of Javascript Date Objects, to check those please go through this Javascript Date Object Complete reference article. Supported Browsers: The browsers supported by the JavaScript Date setTime() Function are listed below: Google Chrome 1 and aboveInternet Explorer 3 and aboveMozilla Firefox 1 and aboveOpera 3 and aboveSafari 1 and above We have a Cheat Sheet on Javascript where we covered all the important topics of Javascript to check those please go through Javascript Cheat Sheet-A Basic guide to JavaScript. Comment More infoAdvertise with us Next Article JavaScript Interview Questions and Answers P pratikraut0000 Follow Improve Article Tags : Technical Scripter JavaScript Web Technologies javascript-functions javascript-date +1 More Similar Reads JavaScript Tutorial JavaScript is a programming language used to create dynamic content for websites. It is a lightweight, cross-platform, and single-threaded programming language. It's an interpreted language that executes code line by line, providing more flexibility.JavaScript on Client Side: On the client side, Jav 11 min read React Interview Questions and Answers React is an efficient, flexible, and open-source JavaScript library that allows developers to create simple, fast, and scalable web applications. Jordan Walke, a software engineer who was working for Facebook, created React. Developers with a JavaScript background can easily develop web applications 15+ min read React Tutorial React is a powerful JavaScript library for building fast, scalable front-end applications. Created by Facebook, it's known for its component-based structure, single-page applications (SPAs), and virtual DOM,enabling efficient UI updates and a seamless user experience.Note: The latest stable version 7 min read JavaScript Interview Questions and Answers JavaScript is the most used programming language for developing websites, web servers, mobile applications, and many other platforms. In Both Front-end and Back-end Interviews, JavaScript was asked, and its difficulty depends upon the on your profile and company. Here, we compiled 70+ JS Interview q 15+ min read Decorators in Python In Python, decorators are a powerful and flexible way to modify or extend the behavior of functions or methods, without changing their actual code. A decorator is essentially a function that takes another function as an argument and returns a new function with enhanced functionality. Decorators are 10 min read AVL Tree Data Structure An AVL tree defined as a self-balancing Binary Search Tree (BST) where the difference between heights of left and right subtrees for any node cannot be more than one. Balance Factor = left subtree height - right subtree heightFor a Balanced Tree(for every node): -1 ⤠Balance Factor ⤠1Example of an 4 min read What is a Neural Network? Neural networks are machine learning models that mimic the complex functions of the human brain. These models consist of interconnected nodes or neurons that process data, learn patterns and enable tasks such as pattern recognition and decision-making.In this article, we will explore the fundamental 12 min read Domain Name System (DNS) DNS is a hierarchical and distributed naming system that translates domain names into IP addresses. When you type a domain name like www.geeksforgeeks.org into your browser, DNS ensures that the request reaches the correct server by resolving the domain to its corresponding IP address.Without DNS, w 8 min read NodeJS Interview Questions and Answers NodeJS is one of the most popular runtime environments, known for its efficiency, scalability, and ability to handle asynchronous operations. It is built on Chromeâs V8 JavaScript engine for executing JavaScript code outside of a browser. It is extensively used by top companies such as LinkedIn, Net 15+ min read HTML Interview Questions and Answers HTML (HyperText Markup Language) is the foundational language for creating web pages and web applications. Whether you're a fresher or an experienced professional, preparing for an HTML interview requires a solid understanding of both basic and advanced concepts. Below is a curated list of 50+ HTML 14 min read Like