How to get Day Month and Year from Date Object in JavaScript ? Last Updated : 28 Nov, 2023 Comments Improve Suggest changes Like Article Like Report We have given the Date object and the task is to extract the Day, Month, and Year from the Date object and print it using JavaScript. Below is an example for better understanding. Example:Input: Date ObjectOutput: Day: 26 Month: 11 Year: 2023To extract Day, Month, and Year from Date Object, we have three different methods which are stated below: Table of Content Using getUTCDate(), getUTCMonth(), and getUTCFullYear() MethodsUsing getDate(), getMonth(), and getFullYear() MethodsUsing toLocaleDateString() MethodMethod 1: Using getUTCDate(), getUTCMonth(), and getUTCFullYear() MethodsIn this method, we are using built-in methods like getUTCDate() to get the day of the month.The getUTCMonth() method to extract the month (Adding 1 because months are zero-indexed).The getUTCFullYear() method to get the full year from the Date object in UTC format. Example: In this example, we will be extracting Day, Month, and Year from the Date object in JavaScript using getUTCDate(), getUTCMonth(), and getUTCFullYear() methods. JavaScript let obj = new Date(); let day = obj.getUTCDate(); let month = obj.getUTCMonth() + 1; let year = obj.getUTCFullYear(); console.log(`Day: ${day}, Month: ${month}, Year: ${year}`); OutputDay: 26, Month: 11, Year: 2023 Method 2: Using getDate(), getMonth(), and getFullYear() MethodsIn this method, we have used local time methods like getDate() to retrieve the date of the month.The getMonth() method to get the month of the Date.The getFullYear() to get the full year from the Date object. This method provides the local time zone for the user to extract the day, month, and year from the Date object. Example: In this example, we will be extracting Day, Month, and Year from the Date object in JavaScript using getDate(), getMonth(), and getFullYear() methods. JavaScript let obj = new Date(); let day = obj.getDate(); let month = obj.getMonth() + 1; let year = obj.getFullYear(); console.log(`Day: ${day}, Month: ${month}, Year: ${year}`); OutputDay: 26, Month: 11, Year: 2023 Method 3: Using toLocaleDateString() MethodIn this method, we are using the toLocalDateString() function with the options like { day: 'numeric', month: 'numeric', year: 'numeric' }.These are used to format the date as a string and split the formatted string into proper day, month, and year formats. Example: In this example, we will be extracting Day, Month, and Year from the Date object in JavaScript using toLocaleDateString() method. JavaScript let obj = new Date(); let temp = { day: 'numeric', month: 'numeric', year: 'numeric' }; let dateFormat = obj.toLocaleDateString(undefined, temp); let [month, day, year] = dateFormat.split('/'); console.log(`Day: ${day}, Month: ${month}, Year: ${year}`); OutputDay: 26, Month: 11, Year: 2023 Comment More infoAdvertise with us Next Article How to get Day Month and Year from Date Object in JavaScript ? G gpancomputer Follow Improve Article Tags : JavaScript Web Technologies Geeks Premier League javascript-date JavaScript-Questions Geeks Premier League 2023 +2 More Similar Reads How to get Month and Date of JavaScript in two digit format ? To get the Month and Date of JavaScript in two-digit format, we have multiple approaches. In this article, we are going to learn how to get the Month and Date of JavaScript in a two-digit format. Below are the approaches used to get the Month and Date of JavaScript in two-digit format: Table of Cont 3 min read How to get the first day of the year in JavaScript ? Given a date/year and the task is to get the first day of the year using JavaScript. Approach 1: Use getFullYear() Method to get the year from the given date.Use the new Date() function to create the new date object using year, month, and day. Example: This example uses the getFullYear() method to g 1 min read How to get the day and month of a year using JavaScript ? Given a date and the task is to get the day and month of a year using JavaScript. Approach: First get the current date by using new Date().Use getDay() method to get the current day in number format, Map it to the day name.Use getMonth() to get the current month in number format, Map it to the month 2 min read How to get the month name from Date using JavaScript ? The purpose of this article is to get the month name from a particular date using JavaScript getMonth() method. This method is used to fetch the month(0 to 11) from the given Date object. It returns an integer value ranging from (0 to 11) Zero (0) means January, 1 means February, and so on, till 11 1 min read How to Add Days to Date in JavaScript? Adding days to a date in JavaScript is a common task when working with dates and times. This involves manipulating the Date object to calculate a future or past date by adding a specific number of days. This is useful for tasks like scheduling events, and deadlines, or simply adjusting dates dynamic 2 min read How to Get the Current Date in JavaScript ? The Date() object is used to access the current date in JavaScript. To get the current date in string format, we can use toDateString() method. The date.toDateString() method converts the given date object into the date portion into a string.SyntaxdateObj.toDateString()JavaScript// Create a Date Obj 2 min read How to Get Current Formatted Date dd/mm/yyyy in JavaScript? Here are different ways to get the current date in dd/mm/yyyy format.1. Using Native JavaScript MethodsJavaScript's built-in Date object provides various methods to work with dates and times. You can extract individual components like day, month, and year to format the date manually.JavaScript// Get 2 min read JavaScript Adding days in milliseconds to Date object Given a date, the task is to add days in milliseconds to it using JavaScript. To add days in milliseconds to date objects in JavaScript, some methods are used which are listed below: JavaScript getMilliseconds() Method: This method returns the milliseconds (from 0 to 999) of the provided date and ti 2 min read How To Format JavaScript Date as yyyy-mm-dd? We use JavaScript built-in help methods from the Date class that help us to create a formatted version of the current date in the form of yyyy-mm-dd. These are the approaches used to format JavaScript date as yyyy-mm-dd.Table of ContentUsing the ISO String Method USing JavaScript Method1. Using the 2 min read How to Format a Date in JavaScript? Here are different ways to format the date in JavaScript.1. Using the toDateString() MethodThe toDateString() method formats the date object into a human-readable format as Day Month Date Year.SyntaxdateObj.toDateString();JavaScriptconst date = new Date(); const formatDate = date.toDateString(); con 2 min read Like