# DateTimeFormatterSkeletonOptions

# DateTimeFormatterSkeletonOptions

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/DateTimeFormatterSkeletonOptions.kt+class:androidx.core.i18n.DateTimeFormatterSkeletonOptions)  
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/DateTimeFormatterSkeletonOptions "View this page in Java")

<br />

```
class DateTimeFormatterSkeletonOptions
```

<br />

*** ** * ** ***

This class helps one create skeleton options for[DateTimeFormatter](https://developer.android.com/reference/kotlin/androidx/core/i18n/DateTimeFormatter)in a safer and more discoverable manner than using raw strings.

Skeletons are a flexible way to specify (in a locale independent manner) how to format of a date / time.

It can be used for example to specify that a formatted date should contain a day-of-month, an abbreviated month name, and a year.

It does not specify the order of the fields, or the separators, those will depend on the locale.

The result will be locale dependent: "Aug 17, 2022" for English U.S., "17 Aug 2022" for English - Great Britain, "2022年8月17日" for Japanese.

Skeletons are based on the[Unicode Technical Standard #35](https://unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table), but uses a builder to make things safer an more discoverable.

You can still build these options from a string by using the[DateTimeFormatterSkeletonOptions.fromString](https://developer.android.com/reference/kotlin/androidx/core/i18n/DateTimeFormatterSkeletonOptions#fromString(kotlin.String))method.

## Summary

|                                                                                                                                                                                 ### Nested types                                                                                                                                                                                  |
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `class `[DateTimeFormatterSkeletonOptions.Builder](https://developer.android.com/reference/kotlin/androidx/core/i18n/DateTimeFormatterSkeletonOptions.Builder) The`Builder`class used to construct a[DateTimeFormatterSkeletonOptions](https://developer.android.com/reference/kotlin/androidx/core/i18n/DateTimeFormatterSkeletonOptions)in a way that is safe and discoverable. |
| `class `[DateTimeFormatterSkeletonOptions.Day](https://developer.android.com/reference/kotlin/androidx/core/i18n/DateTimeFormatterSkeletonOptions.Day) Day of month (numeric).                                                                                                                                                                                                    |
| `class `[DateTimeFormatterSkeletonOptions.Era](https://developer.android.com/reference/kotlin/androidx/core/i18n/DateTimeFormatterSkeletonOptions.Era) Era name.                                                                                                                                                                                                                  |
| `class `[DateTimeFormatterSkeletonOptions.FractionalSecond](https://developer.android.com/reference/kotlin/androidx/core/i18n/DateTimeFormatterSkeletonOptions.FractionalSecond) Fractional Second (numeric).                                                                                                                                                                     |
| `class `[DateTimeFormatterSkeletonOptions.Hour](https://developer.android.com/reference/kotlin/androidx/core/i18n/DateTimeFormatterSkeletonOptions.Hour) Hour (numeric).                                                                                                                                                                                                          |
| `class `[DateTimeFormatterSkeletonOptions.Minute](https://developer.android.com/reference/kotlin/androidx/core/i18n/DateTimeFormatterSkeletonOptions.Minute) Minute (numeric).                                                                                                                                                                                                    |
| `class `[DateTimeFormatterSkeletonOptions.Month](https://developer.android.com/reference/kotlin/androidx/core/i18n/DateTimeFormatterSkeletonOptions.Month) Month number/name.                                                                                                                                                                                                     |
| `class `[DateTimeFormatterSkeletonOptions.Period](https://developer.android.com/reference/kotlin/androidx/core/i18n/DateTimeFormatterSkeletonOptions.Period) The period of the day, if the hour is not 23h or 24h style.                                                                                                                                                          |
| `class `[DateTimeFormatterSkeletonOptions.Second](https://developer.android.com/reference/kotlin/androidx/core/i18n/DateTimeFormatterSkeletonOptions.Second) Second (numeric).                                                                                                                                                                                                    |
| `class `[DateTimeFormatterSkeletonOptions.Timezone](https://developer.android.com/reference/kotlin/androidx/core/i18n/DateTimeFormatterSkeletonOptions.Timezone) The localized representation of the time zone name.                                                                                                                                                              |
| `class `[DateTimeFormatterSkeletonOptions.WeekDay](https://developer.android.com/reference/kotlin/androidx/core/i18n/DateTimeFormatterSkeletonOptions.WeekDay) Day of week name.                                                                                                                                                                                                  |
| `class `[DateTimeFormatterSkeletonOptions.Year](https://developer.android.com/reference/kotlin/androidx/core/i18n/DateTimeFormatterSkeletonOptions.Year) Calendar year (numeric).                                                                                                                                                                                                 |

|                                                     ### Public companion functions                                                     |
|----------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [DateTimeFormatterSkeletonOptions](https://developer.android.com/reference/kotlin/androidx/core/i18n/DateTimeFormatterSkeletonOptions) | [fromString](https://developer.android.com/reference/kotlin/androidx/core/i18n/DateTimeFormatterSkeletonOptions#fromString(kotlin.String))`(value: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`)` Creates the a[DateTimeFormatterSkeletonOptions](https://developer.android.com/reference/kotlin/androidx/core/i18n/DateTimeFormatterSkeletonOptions)object from a string. |

|                                                                           ### Public functions                                                                           |
|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [DateTimeFormatterSkeletonOptions.Day](https://developer.android.com/reference/kotlin/androidx/core/i18n/DateTimeFormatterSkeletonOptions.Day)                           | [getDay](https://developer.android.com/reference/kotlin/androidx/core/i18n/DateTimeFormatterSkeletonOptions#getDay())`()` Returns the day option.                                         |
| [DateTimeFormatterSkeletonOptions.Era](https://developer.android.com/reference/kotlin/androidx/core/i18n/DateTimeFormatterSkeletonOptions.Era)                           | [getEra](https://developer.android.com/reference/kotlin/androidx/core/i18n/DateTimeFormatterSkeletonOptions#getEra())`()` Returns the era option.                                         |
| [DateTimeFormatterSkeletonOptions.FractionalSecond](https://developer.android.com/reference/kotlin/androidx/core/i18n/DateTimeFormatterSkeletonOptions.FractionalSecond) | [getFractionalSecond](https://developer.android.com/reference/kotlin/androidx/core/i18n/DateTimeFormatterSkeletonOptions#getFractionalSecond())`()` Returns the fractional second option. |
| [DateTimeFormatterSkeletonOptions.Hour](https://developer.android.com/reference/kotlin/androidx/core/i18n/DateTimeFormatterSkeletonOptions.Hour)                         | [getHour](https://developer.android.com/reference/kotlin/androidx/core/i18n/DateTimeFormatterSkeletonOptions#getHour())`()` Returns the hour option.                                      |
| [DateTimeFormatterSkeletonOptions.Minute](https://developer.android.com/reference/kotlin/androidx/core/i18n/DateTimeFormatterSkeletonOptions.Minute)                     | [getMinute](https://developer.android.com/reference/kotlin/androidx/core/i18n/DateTimeFormatterSkeletonOptions#getMinute())`()` Returns the minutes option.                               |
| [DateTimeFormatterSkeletonOptions.Month](https://developer.android.com/reference/kotlin/androidx/core/i18n/DateTimeFormatterSkeletonOptions.Month)                       | [getMonth](https://developer.android.com/reference/kotlin/androidx/core/i18n/DateTimeFormatterSkeletonOptions#getMonth())`()` Returns the month option.                                   |
| [DateTimeFormatterSkeletonOptions.Period](https://developer.android.com/reference/kotlin/androidx/core/i18n/DateTimeFormatterSkeletonOptions.Period)                     | [getPeriod](https://developer.android.com/reference/kotlin/androidx/core/i18n/DateTimeFormatterSkeletonOptions#getPeriod())`()` Returns the day period option.                            |
| [DateTimeFormatterSkeletonOptions.Second](https://developer.android.com/reference/kotlin/androidx/core/i18n/DateTimeFormatterSkeletonOptions.Second)                     | [getSecond](https://developer.android.com/reference/kotlin/androidx/core/i18n/DateTimeFormatterSkeletonOptions#getSecond())`()` Returns the seconds option.                               |
| [DateTimeFormatterSkeletonOptions.Timezone](https://developer.android.com/reference/kotlin/androidx/core/i18n/DateTimeFormatterSkeletonOptions.Timezone)                 | [getTimezone](https://developer.android.com/reference/kotlin/androidx/core/i18n/DateTimeFormatterSkeletonOptions#getTimezone())`()` Returns the timezone option.                          |
| [DateTimeFormatterSkeletonOptions.WeekDay](https://developer.android.com/reference/kotlin/androidx/core/i18n/DateTimeFormatterSkeletonOptions.WeekDay)                   | [getWeekDay](https://developer.android.com/reference/kotlin/androidx/core/i18n/DateTimeFormatterSkeletonOptions#getWeekDay())`()` Returns the day of week option.                         |
| [DateTimeFormatterSkeletonOptions.Year](https://developer.android.com/reference/kotlin/androidx/core/i18n/DateTimeFormatterSkeletonOptions.Year)                         | [getYear](https://developer.android.com/reference/kotlin/androidx/core/i18n/DateTimeFormatterSkeletonOptions#getYear())`()` Returns the year option.                                      |
| `open `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)                                                                                 | [toString](https://developer.android.com/reference/kotlin/androidx/core/i18n/DateTimeFormatterSkeletonOptions#toString())`()`                                                             |

## Public companion functions

### fromString

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

```
fun fromString(value: String): DateTimeFormatterSkeletonOptions
```

Creates the a[DateTimeFormatterSkeletonOptions](https://developer.android.com/reference/kotlin/androidx/core/i18n/DateTimeFormatterSkeletonOptions)object from a string.

Although less discoverable than using the`Builder`, it is useful for serialization, and to implement the MessageFormat functionality.  

|                                         Parameters                                         |
|--------------------------------------------------------------------------------------------|--------------------------------------------------------------------------|
| `value: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html) | the skeleton that specifies the fields to be formatted and their length. |

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

|                                                             Throws                                                             |
|--------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [kotlin.IllegalArgumentException](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html) | if the[value](https://developer.android.com/reference/kotlin/androidx/core/i18n/DateTimeFormatterSkeletonOptions.Companion#fromString(kotlin.String))contains an unknown skeleton field. |
| [kotlin.RuntimeException](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-runtime-exception/index.html)                  | library error (unknown skeleton field encountered).                                                                                                                                      |

## Public functions

### getDay

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

```
fun getDay(): DateTimeFormatterSkeletonOptions.Day
```

Returns the day option.  

### getEra

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

```
fun getEra(): DateTimeFormatterSkeletonOptions.Era
```

Returns the era option.  

### getFractionalSecond

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

```
fun getFractionalSecond(): DateTimeFormatterSkeletonOptions.FractionalSecond
```

Returns the fractional second option.  

### getHour

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

```
fun getHour(): DateTimeFormatterSkeletonOptions.Hour
```

Returns the hour option.  

### getMinute

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

```
fun getMinute(): DateTimeFormatterSkeletonOptions.Minute
```

Returns the minutes option.  

### getMonth

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

```
fun getMonth(): DateTimeFormatterSkeletonOptions.Month
```

Returns the month option.  

### getPeriod

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

```
fun getPeriod(): DateTimeFormatterSkeletonOptions.Period
```

Returns the day period option.  

### getSecond

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

```
fun getSecond(): DateTimeFormatterSkeletonOptions.Second
```

Returns the seconds option.  

### getTimezone

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

```
fun getTimezone(): DateTimeFormatterSkeletonOptions.Timezone
```

Returns the timezone option.  

### getWeekDay

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

```
fun getWeekDay(): DateTimeFormatterSkeletonOptions.WeekDay
```

Returns the day of week option.  

### getYear

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

```
fun getYear(): DateTimeFormatterSkeletonOptions.Year
```

Returns the year option.  

### toString

```
open fun toString(): String
```