# DateTimeFormatterJdkStyleOptions

Artifact: [androidx.core:core-i18n](https://developer.android.com/jetpack/androidx/releases/core) [View Source](https://cs.android.com/search?q=file:androidx/core/i18n/DateTimeFormatterJdkStyleOptions.kt+class:androidx.core.i18n.DateTimeFormatterJdkStyleOptions) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/core#1.0.0)

*** ** * ** ***


```
public final class DateTimeFormatterJdkStyleOptions
```

<br />

*** ** * ** ***

This class provides functionality similar to the one in `https://developer.android.com/reference/java/text/DateFormat.html`.

Although not very flexible, it makes migration easier.

## Summary

| ### Public methods |
|---|---|
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/core/i18n/DateTimeFormatterJdkStyleOptions` | `https://developer.android.com/reference/androidx/core/i18n/DateTimeFormatterJdkStyleOptions#createDateInstance(kotlin.Int)(int style)` Gets the date formatter with the given formatting style for the default locale. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/core/i18n/DateTimeFormatterJdkStyleOptions` | `https://developer.android.com/reference/androidx/core/i18n/DateTimeFormatterJdkStyleOptions#createDateTimeInstance(kotlin.Int,kotlin.Int)(int dateStyle, int timeStyle)` Gets the date / time formatter with the given formatting styles for the default locale. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/core/i18n/DateTimeFormatterJdkStyleOptions` | `https://developer.android.com/reference/androidx/core/i18n/DateTimeFormatterJdkStyleOptions#createTimeInstance(kotlin.Int)(int style)` Gets the time formatter with the given formatting style for the default locale. |
| `final int` | `https://developer.android.com/reference/androidx/core/i18n/DateTimeFormatterJdkStyleOptions#getDateStyle()()` |
| `final int` | `https://developer.android.com/reference/androidx/core/i18n/DateTimeFormatterJdkStyleOptions#getTimeStyle()()` |

## Public methods

### createDateInstance

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/core#1.0.0)

```
public static final @NonNull DateTimeFormatterJdkStyleOptions createDateInstance(int style)
```

Gets the date formatter with the given formatting style for the default locale.

| Parameters |
|---|---|
| `int style` | the given date formatting style. For example, SHORT for "M/d/yy" in the US locale. |

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/core/i18n/DateTimeFormatterJdkStyleOptions` | the formatting options to use with `https://developer.android.com/reference/androidx/core/i18n/DateTimeFormatter`. |

### createDateTimeInstance

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/core#1.0.0)

```
public static final @NonNull DateTimeFormatterJdkStyleOptions createDateTimeInstance(int dateStyle, int timeStyle)
```

Gets the date / time formatter with the given formatting styles for the default locale.

| Parameters |
|---|---|
| `int dateStyle` | the given date formatting style. For example, SHORT for "M/d/yy" in the US locale. |
| `int timeStyle` | the given time formatting style. For example, SHORT for "h:mm a" in the US locale. |

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/core/i18n/DateTimeFormatterJdkStyleOptions` | the formatting options to use with `https://developer.android.com/reference/androidx/core/i18n/DateTimeFormatter`. |

### createTimeInstance

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/core#1.0.0)

```
public static final @NonNull DateTimeFormatterJdkStyleOptions createTimeInstance(int style)
```

Gets the time formatter with the given formatting style for the default locale.

| Parameters |
|---|---|
| `int style` | the given time formatting style. For example, SHORT for "h:mm a" in the US locale. |

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/core/i18n/DateTimeFormatterJdkStyleOptions` | the formatting options to use with `https://developer.android.com/reference/androidx/core/i18n/DateTimeFormatter`. |

### getDateStyle

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/core#1.0.0)

```
public final int getDateStyle()
```

### getTimeStyle

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/core#1.0.0)

```
public final int getTimeStyle()
```