# Globalization - [Imported Modules](#en-us_topic_0000001103315838_s56d19203690d4782bfc74069abb6bd71) - [Permissions](#en-us_topic_0000001103315838_section11257113618419) - [Class](#en-us_topic_0000001103315838_section1956131218111) - [Locale](#en-us_topic_0000001103315838_section189341937163212) - [Attributes](#en-us_topic_0000001103315838_section23751576140) - [Locale](#en-us_topic_0000001103315838_section1410593619146) - [DateTimeFormat](#en-us_topic_0000001103315838_section88061769522) - [DateTimeFormat](#en-us_topic_0000001103315838_section28081362523) - [format](#en-us_topic_0000001103315838_section917151185514) ## Imported Modules ``` import Intl from '@ohos.intl'; ``` ## Permissions None. ## Class ## Locale Provides APIs for obtaining locale information. ### Attributes

Name

Type

Readable

Writable

Description

language

string

Yes

No

Indicates the language of the locale.

script

string

Yes

No

Indicates the script of the locale.

region

string

Yes

No

Indicates the region of the locale.

baseName

string

Yes

No

Indicates the basic locale information, which is returned as a substring of a complete locale string.

### Locale A constructor used to create a **Locale** object. **Parameters**

Name

Type

Mandatory

Description

locale

string

Yes

Indicates a character string containing the locale information, including the language and optionally the script and region.

**Example** ``` var enLatnGB = new Intl.Locale("en-Latn-GB"); var enGB = new Intl.Locale("en-GB"); var en = new Intl.Locale("en"); ``` ## DateTimeFormat Provides the API for formatting date strings. ### DateTimeFormat A constructor used to create a **DateTimeFormat** object. **Parameters**

Name

Type

Mandatory

Description

locale

string

Yes

Indicates a character string containing the locale information, including the language and optionally the script and region, for the DateTimeFormat object.

**Example** ``` var dateFmt = new Intl.DateTimeFormat("en-Latn-GB"); ``` ### format Obtains the formatted date strings. **Parameters**

Name

Type

Mandatory

Description

date

Date

Yes

Indicates the Date object to be formatted.

**Return Values**

Type

Description

string

Indicates a date string formatted based on the specified locale.

**Example** ``` var date = new Date(1995, 11, 25, 3, 14, 0); var datefmt = new Intl.DateTimeFormat("en-Latn-GB"); var result = datefmt.format(date); // The formatted date string is Dec 25, 1995. ```