Class DateTimeFormat

java.lang.Object
org.jboss.elemento.intl.DateTimeFormat

@JsType(isNative=true, namespace="<global>", name="Intl.DateTimeFormat") public class DateTimeFormat extends Object
Mapping for Intl.DateTimeFormat.

var date = new JsDate(2020, 11, 20, 3, 23, 16, 738);

// Specify default date formatting for language (locale)
console.log(dateTimeFormat("en-US").format(new JsDate()));
// Expected output: "12/20/2020"

// Specify a date and time format using "style" options (i.e. full, long, medium, short)
console.log(dateTimeFormat("en-GB", dateTimeFormatOptions()
        .dateStyle(full)
        .timeStyle(full)
        .timeZone("Australia/Sydney")).format(date));
// Expected output: "Sunday, 20 December 2020 at 14:23:16 GMT+11"
See Also:
  • Method Details

    • dateTimeFormat

      @JsOverlay public static DateTimeFormat dateTimeFormat()
    • dateTimeFormat

      @JsOverlay public static DateTimeFormat dateTimeFormat(String locale)
    • dateTimeFormat

      @JsOverlay public static DateTimeFormat dateTimeFormat(Locale locale)
    • dateTimeFormat

      @JsOverlay public static DateTimeFormat dateTimeFormat(String[] locales)
    • dateTimeFormat

      @JsOverlay public static DateTimeFormat dateTimeFormat(Locale[] locales)
    • dateTimeFormat

      @JsOverlay public static DateTimeFormat dateTimeFormat(DateTimeFormatOptions options)
    • dateTimeFormat

      @JsOverlay public static DateTimeFormat dateTimeFormat(String locale, DateTimeFormatOptions options)
    • dateTimeFormat

      @JsOverlay public static DateTimeFormat dateTimeFormat(Locale locale, DateTimeFormatOptions options)
    • dateTimeFormat

      @JsOverlay public static DateTimeFormat dateTimeFormat(String[] locales, DateTimeFormatOptions options)
    • dateTimeFormat

      @JsOverlay public static DateTimeFormat dateTimeFormat(Locale[] locales, DateTimeFormatOptions options)
    • supportedLocalesOf

      public static elemental2.core.JsArray<String> supportedLocalesOf(String locale)
    • supportedLocalesOf

      public static elemental2.core.JsArray<String> supportedLocalesOf(String locale, SupportOptions options)
    • supportedLocalesOf

      public static elemental2.core.JsArray<String> supportedLocalesOf(jsinterop.base.JsArrayLike<String> locales)
    • supportedLocalesOf

      public static elemental2.core.JsArray<String> supportedLocalesOf(jsinterop.base.JsArrayLike<String> locales, SupportOptions options)
    • format

      public String format(elemental2.core.JsDate date)
    • formatToParts

      public elemental2.core.JsArray<jsinterop.base.JsPropertyMap<String>> formatToParts(elemental2.core.JsDate date)
    • formatRange

      public String formatRange(elemental2.core.JsDate start, elemental2.core.JsDate end)
    • formatRangeToParts

      public elemental2.core.JsArray<jsinterop.base.JsPropertyMap<String>> formatRangeToParts(elemental2.core.JsDate start, elemental2.core.JsDate end)
    • resolvedOptions

      public jsinterop.base.JsPropertyMap<String> resolvedOptions()