Display current time by using Date.getHours(), Date().getMinutes(), Date().getSeconds() : getMinutes « Date « JavaScript Tutorial






<html>
<head>
<title>Convert Time</title>
</head>
<body>
<script language="JavaScript" type="text/javascript">
<!--

var current_date = new Date();
var hour_value = current_date.getHours();
var minute_value = current_date.getMinutes();
var second_value = current_date.getSeconds();
var AMorPM = "AM";

if (hour_value > 12)
{
  hour_value -= 12;
  AMorPM = "PM";
}

document.write("The current time is " + hour_value + ":" + minute_value +
":" + second_value + " " + AMorPM);

//-->
</script>
</body>
</html>








12.10.getMinutes
12.10.1.Date().getMinutes()
12.10.2.Display current time by using Date.getHours(), Date().getMinutes(), Date().getSeconds()