JavaScript setUTCMinutes 函数可用于根据通用时间设置指定日期的分钟、秒和毫秒,Date 函数的语法是
Date.setUTCMinutes(Minutes, Seconds, Milliseconds)
在此 set UTC Minutes 方法中,秒和毫秒是可选参数。
JavaScript setUTCMinutes 函数示例
在此,我们使用 setUTCMinutes 函数将当前日期分钟设置为 75(根据通用时间)。
<!DOCTYPE html>
<html>
<head>
<title> JS </title>
</head>
<body>
<h1> Example </h1>
<script>
var dt = Date();
document.write("Date and Time : " + dt + "<br/>");
dt.setUTCMinutes(75);
document.write("After : " + dt);
</script>
</body>
</html>
Example
Date and Time: Thu Nov 08 2018 12:24:31 GMT+0530 (Indian Standard Time)
After : Thu Nov 08 2018 12:45:31 GMT+0530 (Indian Standard Time)
在此 set UTC Minutes 示例中,我们根据通用时间,将自定义日期分钟设置为 250,秒设置为 45。
<!DOCTYPE html>
<html>
<head>
<title> JavaScriptSet UTC Minutes Functions </title>
</head>
<body>
<h1> JavaScriptsetUTCMinutesFunctionExample </h1>
<script>
var dt = Date("May 1, 2016 10:11:19");
document.write("Date and Time : " + dt + "<br/>");
dt.setUTCMinutes(250, 45);
document.write("After setUTCMinutes() : " + dt);
</script>
</body>
</html>

在此 JavaScript 示例中,我们将分钟设置为 250,秒设置为 45,毫秒设置为 5000000
<!DOCTYPE html>
<html>
<head>
<title> JS </title>
</head>
<body>
<h1> Example </h1>
<script>
var dt = Date("May 1, 2016 10:11:19");
document.write("Date and Time : " + dt + "<br/>");
dt.setUTCMinutes(250, 45, 5000000);
document.write("After : " + dt);
</script>
</body>
</html>
Example
Date and Time: Sun May 01 2016 10:11:19 GMT+0530 (Indian Standard Time)
After : Sun May 01 2016 15:94:05 GMT+0530 (Indian Standard Time)