Home » JavaScript

Date getMinutes() method with example in JavaScript

JavaScript Date getMinutes() method: Here, we are going to learn about the getMinutes() method of Date class with Example in JavaScript.
Submitted by IncludeHelp, on March 04, 2019

JavaScript Date getMinutes() method

getMinutes() method is a Date's class method and it is used to get the only minutes from the current time.

It accepts nothing as the parameter and returns a value between 0 to 59.

Syntax:

    var dt = new Date();
    dt.getMinutes();

Examples:

    Input:
    var dt = new Date();
    dt.getMinutes();
    
    Output:
    18 (if the time is any_hour:18:any_seconds)

JavaScript code to get the hours only from the current time using getHours() method

<html>
<head><title>JavaScipt Example</title></head>

<body>
<script>
	var dt = new Date(); //Date constructor 
	var minutes = dt.getMinutes(); //getting minutes from current time
	//printing minutes
	document.write("Current minutes is : " + minutes);
</script>
</body>
</html>

Output

Current minutes is : 18





Comments and Discussions

Ad: Are you a blogger? Join our Blogging forum.



Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing » Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates

© https://www.includehelp.com some rights reserved.