Die getUTCMonth()
Methode gibt den Monat eines Datums bezüglich der Weltzeit zurück. Dieser Wert ist 0-basierend (0 steht für den ersten Monat im Jahr).
The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request.
Syntax
dateObj.getUTCMonth()
Rückgabewert
Eine ganze Zahl zwischen 0 und 11, die den Monat des gegebenen Datums bezüglich der Weltzeit (UTC) angibt. 0 steht für Januar, 1 für Februar, 2 für März und so weiter.
Beispiele
Einsatz von getUTCMonth()
Das folgende Beispiel weist der month
Variable den aktuellen Monat zu.
var today = new Date();
var month = today.getUTCMonth();
Spezifikationen
Spezifikation | Status | Kommentar |
---|---|---|
ECMAScript 1st Edition (ECMA-262) | Standard | Initiale Definition. Implementiert in JavaScript 1.3. |
ECMAScript 5.1 (ECMA-262) Die Definition von 'Date.prototype.getUTCMonth' in dieser Spezifikation. |
Standard | |
ECMAScript 2015 (6th Edition, ECMA-262) Die Definition von 'Date.prototype.getUTCMonth' in dieser Spezifikation. |
Standard | |
ECMAScript (ECMA-262) Die Definition von 'Date.prototype.getUTCMonth' in dieser Spezifikation. |
Lebender Standard |
Browserkompatibilität
BCD tables only load in the browser
The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.