# DateTimeFormatterJdkStyleOptions

# 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)

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/androidx/core/i18n/DateTimeFormatterJdkStyleOptions "View this page in Java")

<br />

```
class DateTimeFormatterJdkStyleOptions
```

<br />

*** ** * ** ***

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

Although not very flexible, it makes migration easier.

## Summary

|                                                     ### Public companion functions                                                     |
|----------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [DateTimeFormatterJdkStyleOptions](https://developer.android.com/reference/kotlin/androidx/core/i18n/DateTimeFormatterJdkStyleOptions) | [createDateInstance](https://developer.android.com/reference/kotlin/androidx/core/i18n/DateTimeFormatterJdkStyleOptions#createDateInstance(kotlin.Int))`(style: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`)` Gets the date formatter with the given formatting style for the default locale.                                                                                                                          |
| [DateTimeFormatterJdkStyleOptions](https://developer.android.com/reference/kotlin/androidx/core/i18n/DateTimeFormatterJdkStyleOptions) | [createDateTimeInstance](https://developer.android.com/reference/kotlin/androidx/core/i18n/DateTimeFormatterJdkStyleOptions#createDateTimeInstance(kotlin.Int,kotlin.Int))`(dateStyle: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`, timeStyle: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`)` Gets the date / time formatter with the given formatting styles for the default locale. |
| [DateTimeFormatterJdkStyleOptions](https://developer.android.com/reference/kotlin/androidx/core/i18n/DateTimeFormatterJdkStyleOptions) | [createTimeInstance](https://developer.android.com/reference/kotlin/androidx/core/i18n/DateTimeFormatterJdkStyleOptions#createTimeInstance(kotlin.Int))`(style: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`)` Gets the time formatter with the given formatting style for the default locale.                                                                                                                          |

|                            ### Public properties                            |
|-----------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------|
| [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [dateStyle](https://developer.android.com/reference/kotlin/androidx/core/i18n/DateTimeFormatterJdkStyleOptions#dateStyle()) |
| [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [timeStyle](https://developer.android.com/reference/kotlin/androidx/core/i18n/DateTimeFormatterJdkStyleOptions#timeStyle()) |

## Public companion functions

### createDateInstance

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

```
fun createDateInstance(style: Int): DateTimeFormatterJdkStyleOptions
```

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

|                                      Parameters                                      |
|--------------------------------------------------------------------------------------|------------------------------------------------------------------------------------|
| `style: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | the given date formatting style. For example, SHORT for "M/d/yy" in the US locale. |

|                                                                Returns                                                                 |
|----------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [DateTimeFormatterJdkStyleOptions](https://developer.android.com/reference/kotlin/androidx/core/i18n/DateTimeFormatterJdkStyleOptions) | the formatting options to use with[androidx.core.i18n.DateTimeFormatter](https://developer.android.com/reference/kotlin/androidx/core/i18n/DateTimeFormatter). |

### createDateTimeInstance

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

```
fun createDateTimeInstance(dateStyle: Int, timeStyle: Int): DateTimeFormatterJdkStyleOptions
```

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

|                                        Parameters                                        |
|------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------|
| `dateStyle: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | the given date formatting style. For example, SHORT for "M/d/yy" in the US locale. |
| `timeStyle: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | the given time formatting style. For example, SHORT for "h:mm a" in the US locale. |

|                                                                Returns                                                                 |
|----------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [DateTimeFormatterJdkStyleOptions](https://developer.android.com/reference/kotlin/androidx/core/i18n/DateTimeFormatterJdkStyleOptions) | the formatting options to use with[androidx.core.i18n.DateTimeFormatter](https://developer.android.com/reference/kotlin/androidx/core/i18n/DateTimeFormatter). |

### createTimeInstance

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

```
fun createTimeInstance(style: Int): DateTimeFormatterJdkStyleOptions
```

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

|                                      Parameters                                      |
|--------------------------------------------------------------------------------------|------------------------------------------------------------------------------------|
| `style: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | the given time formatting style. For example, SHORT for "h:mm a" in the US locale. |

|                                                                Returns                                                                 |
|----------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [DateTimeFormatterJdkStyleOptions](https://developer.android.com/reference/kotlin/androidx/core/i18n/DateTimeFormatterJdkStyleOptions) | the formatting options to use with[androidx.core.i18n.DateTimeFormatter](https://developer.android.com/reference/kotlin/androidx/core/i18n/DateTimeFormatter). |

## Public properties

### dateStyle

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

```
val dateStyle: Int
```  

### timeStyle

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

```
val timeStyle: Int
```