A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://developer.mozilla.org/de/docs/Web/JavaScript/Reference/Global_Objects/Intl/DurationFormat below:

Intl.DurationFormat - JavaScript | MDN

Intl.DurationFormat

Baseline 2025

Newly available

Das Intl.DurationFormat-Objekt ermöglicht die sprachsensitive Formatierung von Zeitdauern.

Konstruktor
Intl.DurationFormat()

Erstellt ein neues Intl.DurationFormat-Objekt.

Statische Methoden
Intl.DurationFormat.supportedLocalesOf()

Gibt ein Array zurück, das die der angegebenen Lokalisierungen enthält, die unterstützt werden, ohne auf die Standard-Lokalisierung der Laufzeitumgebung zurückgreifen zu müssen.

Instanz-Eigenschaften

Diese Eigenschaften sind auf Intl.DurationFormat.prototype definiert und werden von allen Intl.DurationFormat-Instanzen geteilt.

Intl.DurationFormat.prototype.constructor

Die Konstruktorfunktion, die das Instanzobjekt erstellt hat. Für Intl.DurationFormat-Instanzen ist der Anfangswert der Intl.DurationFormat-Konstruktor.

Intl.DurationFormat.prototype[Symbol.toStringTag]

Der Anfangswert der [Symbol.toStringTag]-Eigenschaft ist der String "Intl.DurationFormat". Diese Eigenschaft wird in Object.prototype.toString() verwendet.

Instanz-Methoden
Intl.DurationFormat.prototype.format()

Getter-Funktion, die eine Dauer gemäß der Lokalisierung und den Formatierungsoptionen dieses DurationFormat-Objekts formatiert.

Intl.DurationFormat.prototype.formatToParts()

Gibt ein Array von Objekten zurück, die die formatierte Dauer in Teilen darstellen.

Intl.DurationFormat.prototype.resolvedOptions()

Gibt ein neues Objekt mit Eigenschaften zurück, die die bei der Initialisierung des Objekts ermittelten Lokalisierungs- und Formatierungsoptionen widerspiegeln.

Beispiele Verwendung von Intl.DurationFormat

Die folgenden Beispiele zeigen, wie Sie das Intl.DurationFormat-Objekt verwenden, um ein Dauerobjekt mit verschiedenen Lokalisierungen und Stilen zu formatieren.

const duration = {
  hours: 1,
  minutes: 46,
  seconds: 40,
};

// With style set to "long" and locale "fr-FR"
new Intl.DurationFormat("fr-FR", { style: "long" }).format(duration);
// "1 heure, 46 minutes et 40 secondes"

// With style set to "short" and locale "en"
new Intl.DurationFormat("en", { style: "short" }).format(duration);
// "1 hr, 46 min and 40 sec"

// With style set to "narrow" and locale "pt"
new Intl.DurationFormat("pt", { style: "narrow" }).format(duration);
// "1h 46min 40s"
Spezifikationen Browser-Kompatibilität Siehe auch MDN-Feedback-Box War diese Übersetzung hilfreich?

Diese Seite wurde automatisch aus dem Englischen übersetzt.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4