---
title: "User Preferences"
description: Obtain the currently logged-in user preferences, like theme or language.
---


Obtain the currently logged-in user preferences, like theme or language.

import NpmLogo from '@site/static/img/npm-logo.png';

<div class="row margin-bottom--md">
  <div class="col">
    <a href="https://www.npmjs.com/package/@dynatrace-sdk/user-preferences" target="_blank" rel="noopener noreferrer"> <span class="margin-right--xs">@dynatrace-sdk/user-preferences</span> <img className="no-zoom" width="20px" src={NpmLogo} /> </a>
  </div>
  <div class="col" style={{textAlign: 'right'}}>
    <a href="https://www.npmjs.com/package/@dynatrace-sdk/user-preferences/v/1.1.6" target="_blank" rel="noopener noreferrer">v1.1.6</a>
  </div>
</div>

```bash
npm install @dynatrace-sdk/user-preferences
```


## Functions



### getLanguage

<div class="padding-bottom--md">
<strong>getLanguage(): [string](https://developer.mozilla.org/en-US/docs/Glossary/String)</strong>

<div class="padding-left--md">

Retrieves the user preferred language.



</div>



#### Returns

| Return type | Description |
|---|---|
|[string](https://developer.mozilla.org/en-US/docs/Glossary/String) | language defined in user preferences.|



<details>
<summary>
Code example
</summary>

```ts
// Import the getLanguage function
import { getLanguage } from '@dynatrace-sdk/user-preferences';

// Get the user's language preference
const language = getLanguage();
```

</details>



</div>





### getRegionalFormat

<div class="padding-bottom--md">
<strong>getRegionalFormat(): [string](https://developer.mozilla.org/en-US/docs/Glossary/String)</strong>

<div class="padding-left--md">

Retrieves the user regional format.



</div>



#### Returns

| Return type | Description |
|---|---|
|[string](https://developer.mozilla.org/en-US/docs/Glossary/String) | regional format defined in user preferences.|



<details>
<summary>
Code example
</summary>

```ts
// Import the getRegionalFormat function
import { getRegionalFormat } from '@dynatrace-sdk/user-preferences';

// Get the user's regional format preference
const regionalFormat = getRegionalFormat();
```

</details>



</div>





### getTheme

<div class="padding-bottom--md">
<strong>getTheme(): ThemeType</strong>

<div class="padding-left--md">

Retrieves the user preferred theme.



</div>



#### Returns

| Return type | Description |
|---|---|
|[ThemeType](#themetype) | theme defined in user preferences.|



<details>
<summary>
Code example
</summary>

```ts
// Import the getTheme function
import { getTheme } from '@dynatrace-sdk/user-preferences';

// Get the user's theme preference
const theme = getTheme();
```

</details>



</div>





### getTimezone

<div class="padding-bottom--md">
<strong>getTimezone(): [string](https://developer.mozilla.org/en-US/docs/Glossary/String)</strong>

<div class="padding-left--md">

Retrieves the user preferred timezone.

Timezone can be either in ISO 8601 or tz database format.



</div>



#### Returns

| Return type | Description |
|---|---|
|[string](https://developer.mozilla.org/en-US/docs/Glossary/String) | timezone defined in user preferences.|



<details>
<summary>
Code example
</summary>

```ts
// Import the getTimezone function
import { getTimezone } from '@dynatrace-sdk/user-preferences';

// Get the user's timezone preference
const timezone = getTimezone();
```

</details>



</div>



