JavaScript Data setMinutes()
Przykład 1
Ustaw minuty na 17:
const d = new Date();
d.setMinutes(17);
Definicja i użycie
setMinutes()
ustawia minuty daty.
Tej metody można również użyć do ustawienia sekund i milisekund.
Przykład 2
Ustaw datę i godzinę na 90 minut temu :
const d = new Date();
d.setMinutes(d.getMinutes() - 90);
Obsługa przeglądarki
setMinutes()
to funkcja ECMAScript1 (ES1).
ES1 (JavaScript 1997) jest w pełni obsługiwany we wszystkich przeglądarkach:
Chrome | IE | Edge | Firefox | Safari | Opera |
Yes | Yes | Yes | Yes | Yes | Yes |
Składnia
Date.setMinutes(min, sec, millisec)
Wartości parametrów
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:
|
Szczegóły techniczne
Wartość zwrotu: | Liczba reprezentująca liczbę milisekund między obiektem daty a północą 1 stycznia 1970 |
---|---|
Wersja JavaScript: | ECMAScript 1 |