DateTimeFormat

The declaration of a DateTimeFormat has the form:

new Intl.DateT imeFormat([locales[,options]])

A related function is: Date.prototype.to[Locale]{String|DateString|TimeString}()(8.18.3)

localesOptional. A string with a BCP 47 language tag, or an array of such strings. For the general form and interpretation of the locales argument, see the Intl page. The following Unicode extension keys are allowed:
nuNumbering system. Possible values include: "arab", "arabext", "bali", "beng", "deva", "fullwide", "gujr", "guru", "hanidec", "khmr", "knda", "laoo", "latn", "limb", "mlym", "mong", "mymr", "orya", "tamldec", "telu", "thai", "tibt".
caCalendar. Possible values include: "buddhist", "chinese", "coptic", "ethioaa", "ethiopic", "gregory", "hebrew", "indian", "islamic", "islamicc", "iso8601", "japanese", "persian", "roc".
optionsOptional. An object with some or all of the following properties:
RESETRUNFULL
<!DOCTYPE html><html><body><script>

localeMatcherThe locale matching algorithm to use. Possible values are "lookup" and "best fit"; the default is "best fit". For information about this option, see the Intl page.

</script></body><html>

<!DOCTYPE html><html><body><script>

timeZoneThe time zone to use. The only value implementations must recognize is "UTC"; the default is the runtime's default time zone. Implementations may also recognize the time zone names of the IANA time zone database, such as "Asia/Shanghai", "Asia/Kolkata", "America/New_York".

</script></body><html>

<!DOCTYPE html><html><body><script>

hour12Whether to use 12-hour time (as opposed to 24-hour time). Possible values are true and false; the default is locale-dependent.

</script></body><html>

<!DOCTYPE html><html><body><script>

formatMatcherThe format matching algorithm to use. Possible values are "basic" and "best fit"; the default is "best fit". See the following paragraphs for information about the use of this property.

</script></body><html>

RESETRUNFULL
<!DOCTYPE html><html><body><script>



				<!DOCTYPE html><html><body><script>var d = new Date('05-31-1999');;var l10nEN = new Intl.DateTimeFormat("en-US"); var l10nDE = new Intl.DateTimeFormat("de-DE");console.log(l10nEN.format(d)); // 5/31/1999console.log(l10nDE.format(d)); // 31.5.1999console.log(new Intl.DateTimeFormat('en-GB').format(d));  // 31/05/1999console.log(new Intl.DateTimeFormat('ko-KR').format(d));   // 1999. 5. 31.console.log(new Intl.DateTimeFormat('ar-EG').format(d));   // ٣١‏/٥‏/١٩٩٩console.log(new Intl.DateTimeFormat(
               'ja-JP-u-ca-japanese').format(d)); // 平成11/5/31console.log(new Intl.DateTimeFormat([
               'ban', 'id']).format(d)); // 31/5/1999var options = { weekday: 'long', year: 'numeric',
                        month: 'long', day: 'numeric' };console.log(new Intl.DateTimeFormat(
         'de-DE', options).format(d)); // Montag, 31. Mai 1999options.timeZone = 'UTC';options.timeZoneName = 'short';console.log(new Intl.DateTimeFormat('en-US', options).formatToParts(d)); // [Object, Object, Object, Object, Object, Object, Object, //
  Object, Object]console.log(new Intl.DateTimeFormat().resolvedOptions()); /* Object {locale: "en-GB", numberingSystem: "latn", calendar: "gregory", timeZone: "Asia/Kuala_Lumpur", year: "numeric"…} */options = {
   hour: 'numeric', minute: 'numeric', second: 'numeric',
   timeZoneName: 'short'};console.log(new Intl.DateTimeFormat('en-AU', options).format(d));   // 12:00:00 am GMT+8options = {
   year: 'numeric', month: 'numeric', day: 'numeric',
   hour: 'numeric', minute: 'numeric', second: 'numeric',
   hour12: false};console.log(d.toLocaleString('en-US', options));  // 5/31/1999, 00:00:00</script></body></html>

</script></body><html>