Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Nested Classes](https://developer.android.com/reference/com/google/wear/services/complications/TimeFormatComplicationText#nestedclasses) \| [Constants](https://developer.android.com/reference/com/google/wear/services/complications/TimeFormatComplicationText#constants) \| [Ctors](https://developer.android.com/reference/com/google/wear/services/complications/TimeFormatComplicationText#pubctors) \| [Methods](https://developer.android.com/reference/com/google/wear/services/complications/TimeFormatComplicationText#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/com/google/wear/services/complications/TimeFormatComplicationText#inhmethods)

# TimeFormatComplicationText


`
public

final

class
TimeFormatComplicationText
`


`

extends Object


`

`


implements

https://developer.android.com/reference/com/google/wear/services/complications/TimeDependentText


`

|---|---|
| java.lang.Object ||
| ↳ | com.google.wear.services.complications.TimeFormatComplicationText |

<br />

*** ** * ** ***

Class to generate string representations of dates/times according to a specified format.

Note: The preferred way to define dynamic data for complication text is to use a `https://developer.android.com/reference/com/google/wear/services/complications/DynamicComplicationText`. That will be the only supported way to create this type of `https://developer.android.com/reference/com/google/wear/services/complications/ComplicationText` in the future.

## Summary

| ### Nested classes ||
|---|---|
| ` class` | `https://developer.android.com/reference/com/google/wear/services/complications/TimeFormatComplicationText.Builder` Builder for `https://developer.android.com/reference/com/google/wear/services/complications/TimeFormatComplicationText`. |

| ### Constants ||
|---|---|
| `int` | `https://developer.android.com/reference/com/google/wear/services/complications/TimeFormatComplicationText#STYLE_DEFAULT` Style where the formatted date/time should be shown unchanged. |
| `int` | `https://developer.android.com/reference/com/google/wear/services/complications/TimeFormatComplicationText#STYLE_LOWER_CASE` Style where the formatted date/time should be shown in lower case. |
| `int` | `https://developer.android.com/reference/com/google/wear/services/complications/TimeFormatComplicationText#STYLE_UPPER_CASE` Style where the formatted date/time should be capitalized. |

| ### Public constructors ||
|---|---|
| ` https://developer.android.com/reference/com/google/wear/services/complications/TimeFormatComplicationText#TimeFormatComplicationText(java.lang.CharSequence,%20java.lang.String,%20int,%20android.icu.util.TimeZone)(CharSequence surroundingText, String format, int style, TimeZone timeZone) ` |

| ### Public methods ||
|---|---|
| ` boolean` | ` https://developer.android.com/reference/com/google/wear/services/complications/TimeFormatComplicationText#equals(java.lang.Object)(Object o) ` |
| ` SimpleDateFormat` | ` https://developer.android.com/reference/com/google/wear/services/complications/TimeFormatComplicationText#getFormat()() ` |
| ` String` | ` https://developer.android.com/reference/com/google/wear/services/complications/TimeFormatComplicationText#getFormatString()() ` |
| ` long` | ` https://developer.android.com/reference/com/google/wear/services/complications/TimeFormatComplicationText#getNextChangeTimeMillis(long)(long fromTime) ` Returns the next time after `fromTime` at which the text may change. |
| ` long` | ` https://developer.android.com/reference/com/google/wear/services/complications/TimeFormatComplicationText#getPrecisionMillis()() ` |
| ` int` | ` https://developer.android.com/reference/com/google/wear/services/complications/TimeFormatComplicationText#getStyle()() ` Returns the time format style to be used when formatting the text. |
| ` CharSequence` | ` https://developer.android.com/reference/com/google/wear/services/complications/TimeFormatComplicationText#getSurroundingText()() ` |
| ` TimeZone` | ` https://developer.android.com/reference/com/google/wear/services/complications/TimeFormatComplicationText#getTimeZone()() ` |
| ` int` | ` https://developer.android.com/reference/com/google/wear/services/complications/TimeFormatComplicationText#hashCode()() ` |
| ` boolean` | ` https://developer.android.com/reference/com/google/wear/services/complications/TimeFormatComplicationText#returnsSameTextAt(long,%20long)(long firstDateTimeMillis, long secondDateTimeMillis) ` Returns true if the result of the calculation of the current text will be the same for both `firstDateTimeMillis` and `secondDateTimeMillis`. |
| ` String` | ` https://developer.android.com/reference/com/google/wear/services/complications/TimeFormatComplicationText#toString()() ` |

| ### Inherited methods |
|---|---|
| From class ` java.lang.Object ` |---|---| | ` Object` | ` clone() ` | | ` boolean` | ` equals(Object arg0) ` | | ` void` | ` finalize() ` | | ` final Class<?>` | ` getClass() ` | | ` int` | ` hashCode() ` | | ` final void` | ` notify() ` | | ` final void` | ` notifyAll() ` | | ` String` | ` toString() ` | | ` final void` | ` wait(long arg0, int arg1) ` | | ` final void` | ` wait(long arg0) ` | | ` final void` | ` wait() ` | ||
| From interface ` https://developer.android.com/reference/com/google/wear/services/complications/TimeDependentText ` |---|---| | ` abstract long` | ` https://developer.android.com/reference/com/google/wear/services/complications/TimeDependentText#getNextChangeTimeMillis(long)(long fromTime) ` Returns the next time after `fromTime` at which the text may change. | | ` abstract boolean` | ` https://developer.android.com/reference/com/google/wear/services/complications/TimeDependentText#returnsSameTextAt(long,%20long)(long firstDateTimeMillis, long secondDateTimeMillis) ` Returns true if the result of the calculation of the current text will be the same for both `firstDateTimeMillis` and `secondDateTimeMillis`. | ||
| From interface ` https://developer.android.com/reference/com/google/wear/services/complications/ComplicationText ` |---|---| | ` default boolean` | ` https://developer.android.com/reference/com/google/wear/services/complications/ComplicationText#isPlaceholder()() ` Returns if this `ComplicationText` is a placeholder. | ||

## Constants

### STYLE_DEFAULT

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int STYLE_DEFAULT
```

Style where the formatted date/time should be shown unchanged.

<br />

Constant Value:

1
(0x00000001)


### STYLE_LOWER_CASE

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int STYLE_LOWER_CASE
```

Style where the formatted date/time should be shown in lower case.

<br />

Constant Value:

3
(0x00000003)


### STYLE_UPPER_CASE

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int STYLE_UPPER_CASE
```

Style where the formatted date/time should be capitalized.

<br />

Constant Value:

2
(0x00000002)


## Public constructors

### TimeFormatComplicationText

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public TimeFormatComplicationText (CharSequence surroundingText, 
                String format, 
                int style, 
                TimeZone timeZone)
```

<br />

<br />

| Parameters ||
|---|---|
| `surroundingText` | `CharSequence` <br /> |
| `format` | `String` <br /> |
| `style` | `int`: Value is one of the following: - `https://developer.android.com/reference/com/google/wear/services/complications/TimeFormatComplicationText#STYLE_DEFAULT` - `https://developer.android.com/reference/com/google/wear/services/complications/TimeFormatComplicationText#STYLE_UPPER_CASE` - `https://developer.android.com/reference/com/google/wear/services/complications/TimeFormatComplicationText#STYLE_LOWER_CASE` |
| `timeZone` | `TimeZone` <br /> |

## Public methods

### equals

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean equals (Object o)
```

<br />

<br />

| Parameters ||
|---|---|
| `o` | `Object` <br /> |

| Returns ||
|---|---|
| `boolean` | <br /> |

### getFormat

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public SimpleDateFormat getFormat ()
```

<br />

<br />

| Returns ||
|---|---|
| `SimpleDateFormat` | <br /> |

### getFormatString

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public String getFormatString ()
```

<br />

<br />

| Returns ||
|---|---|
| `String` | <br /> |

### getNextChangeTimeMillis

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public long getNextChangeTimeMillis (long fromTime)
```

Returns the next time after `fromTime` at which the text may change.

<br />

| Parameters ||
|---|---|
| `fromTime` | `long` <br /> |

| Returns ||
|---|---|
| `long` | <br /> |

### getPrecisionMillis

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public long getPrecisionMillis ()
```

<br />

<br />

| Returns ||
|---|---|
| `long` | The time precision in milliseconds derived from the date and time format. <br /> |

### getStyle

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public int getStyle ()
```

Returns the time format style to be used when formatting the text.

<br />

| Returns ||
|---|---|
| `int` | Value is one of the following: - `https://developer.android.com/reference/com/google/wear/services/complications/TimeFormatComplicationText#STYLE_DEFAULT` - `https://developer.android.com/reference/com/google/wear/services/complications/TimeFormatComplicationText#STYLE_UPPER_CASE` - `https://developer.android.com/reference/com/google/wear/services/complications/TimeFormatComplicationText#STYLE_LOWER_CASE` |

### getSurroundingText

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public CharSequence getSurroundingText ()
```

<br />

<br />

| Returns ||
|---|---|
| `CharSequence` | <br /> |

### getTimeZone

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public TimeZone getTimeZone ()
```

<br />

<br />

| Returns ||
|---|---|
| `TimeZone` | <br /> |

### hashCode

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public int hashCode ()
```

<br />

<br />

| Returns ||
|---|---|
| `int` | <br /> |

### returnsSameTextAt

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean returnsSameTextAt (long firstDateTimeMillis, 
                long secondDateTimeMillis)
```

Returns true if the result of the calculation of the current text will be the same for both
`firstDateTimeMillis` and `secondDateTimeMillis`.

<br />

| Parameters ||
|---|---|
| `firstDateTimeMillis` | `long` <br /> |
| `secondDateTimeMillis` | `long` <br /> |

| Returns ||
|---|---|
| `boolean` | <br /> |

### toString

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public String toString ()
```

<br />

<br />

| Returns ||
|---|---|
| `String` | <br /> |