JavaScript วันที่ setUTCMinutes()
ตัวอย่าง
ตั้งค่านาทีเป็น 17 ตามเวลา UTC:
const d = new Date();
d.setUTCMinutes(17);
ตัวอย่าง "ลองใช้เอง" เพิ่มเติมด้านล่าง
ความหมายและการใช้งาน
เมธอด setUTCMinutes() ตั้งค่านาทีของอ็อบเจ็กต์วันที่ตาม UTC
หมายเหตุ
UTC (Universal Time Coordinated) คือเวลาที่กำหนดโดยมาตรฐานเวลาโลก
เวลา UTC จะเหมือนกับเวลา GMT (เวลามาตรฐานกรีนิช)
รองรับเบราว์เซอร์
setUTCMinutes()
เป็นคุณลักษณะ ECMAScript1 (ES1)
ES1 (JavaScript 1997) ได้รับการสนับสนุนอย่างสมบูรณ์ในเบราว์เซอร์ทั้งหมด:
Chrome | IE | Edge | Firefox | Safari | Opera |
Yes | Yes | Yes | Yes | Yes | Yes |
ไวยากรณ์
Date.setUTCMinutes(min, sec, millisec)
ค่าพารามิเตอร์
Parameter | Description |
---|---|
min | Required. An integer representing the minutes.
Expected values are 0-59, but other values are allowed:
|
sec | Optional. An integer representing the seconds
Expected values are 0-59, but other values are allowed:
|
millisec | Optional. An integer representing the milliseconds
Expected values are 0-999, but other values are allowed:
|
รายละเอียดทางเทคนิค
คืนมูลค่า: | หมายเลข. จำนวนมิลลิวินาทีระหว่างวันที่ถึงวันที่ 1 มกราคม 1970 00:00:00 UTC |
---|
ตัวอย่างเพิ่มเติม
ตัวอย่าง
ตั้งค่าวันที่เป็น 90 นาทีที่แล้วโดยใช้วิธี UTC:
const d = new Date();
d.setUTCMinutes(d.getUTCMinutes() - 90);