JavaScript Date setUTCMinutes()
Esempio
Impostare i minuti su 17, in base all'ora UTC:
const d = new Date();
d.setUTCMinutes(17);
Altri esempi "Provalo da solo" di seguito.
Definizione e utilizzo
Il metodo setUTCMinutes() imposta i minuti di un oggetto data, secondo UTC.
Appunti
UTC (Universal Time Coordinated) è l'ora impostata dal World Time Standard.
L'ora UTC è la stessa dell'ora GMT (Greenwich Mean Time).
Supporto browser
setUTCMinutes()
è una funzione ECMAScript1 (ES1).
ES1 (JavaScript 1997) è completamente supportato in tutti i browser:
Chrome | IE | Edge | Firefox | Safari | Opera |
Yes | Yes | Yes | Yes | Yes | Yes |
Sintassi
Date.setUTCMinutes(min, sec, millisec)
Valori dei parametri
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:
|
Dettagli tecnici
Valore di ritorno: | Un numero. Numero di millisecondi tra la data e il 1 gennaio 1970 00:00:00 UTC. |
---|
Altri esempi
Esempio
Imposta la data e l'ora su 90 minuti fa , utilizzando i metodi UTC:
const d = new Date();
d.setUTCMinutes(d.getUTCMinutes() - 90);