# ComplicationText.TimeFormatBuilder

Summary:[Ctors](https://developer.android.com/reference/android/support/wearable/complications/ComplicationText.TimeFormatBuilder#pubctors)\|[Methods](https://developer.android.com/reference/android/support/wearable/complications/ComplicationText.TimeFormatBuilder#pubmethods)\|[Inherited Methods](https://developer.android.com/reference/android/support/wearable/complications/ComplicationText.TimeFormatBuilder#inhmethods)  

# ComplicationText.TimeFormatBuilder

`
public
static
final

class
ComplicationText.TimeFormatBuilder
`  
`

extends `[Object](http://developer.android.com/reference/java/lang/Object.html)`


``


`

|---|---------------------------------------------------------------------------|
| [java.lang.Object](http://developer.android.com/reference/java/lang/Object.html) ||
| ↳ | android.support.wearable.complications.ComplicationText.TimeFormatBuilder |

<br />

*** ** * ** ***

<br />

**This class is deprecated.**   
use the[Jetpack Wear Watch Face](https://developer.android.com/jetpack/androidx/releases/wear-watchface)libraries instead.

Builder for a ComplicationText object that displays a text representation of the given time, using the provided format and time zone, within a surrounding string if specified.

## Summary

|                                                                          ### Public constructors                                                                           ||
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| ` `[TimeFormatBuilder](https://developer.android.com/reference/android/support/wearable/complications/ComplicationText.TimeFormatBuilder.html#TimeFormatBuilder())`() ` |

|                                                                                                                                                                                                                                                            ### Public methods                                                                                                                                                                                                                                                            ||
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` `[ComplicationText](https://developer.android.com/reference/android/support/wearable/complications/ComplicationText.html)                                     | ` `[build](https://developer.android.com/reference/android/support/wearable/complications/ComplicationText.TimeFormatBuilder.html#build())`() ` Returns[ComplicationText](https://developer.android.com/reference/android/support/wearable/complications/ComplicationText.html)including the formatted time as specified.                                               |
| ` `[ComplicationText.TimeFormatBuilder](https://developer.android.com/reference/android/support/wearable/complications/ComplicationText.TimeFormatBuilder.html) | ` `[setFormat](https://developer.android.com/reference/android/support/wearable/complications/ComplicationText.TimeFormatBuilder.html#setFormat(java.lang.String))`(`[String](http://developer.android.com/reference/java/lang/String.html)` format) ` Sets the format that should be applied to the date.                                                              |
| ` `[ComplicationText.TimeFormatBuilder](https://developer.android.com/reference/android/support/wearable/complications/ComplicationText.TimeFormatBuilder.html) | ` `[setStyle](https://developer.android.com/reference/android/support/wearable/complications/ComplicationText.TimeFormatBuilder.html#setStyle(int))`(int style) ` Sets the style in which the time format part will be displayed.                                                                                                                                       |
| ` `[ComplicationText.TimeFormatBuilder](https://developer.android.com/reference/android/support/wearable/complications/ComplicationText.TimeFormatBuilder.html) | ` `[setSurroundingText](https://developer.android.com/reference/android/support/wearable/complications/ComplicationText.TimeFormatBuilder.html#setSurroundingText(java.lang.CharSequence))`(`[CharSequence](http://developer.android.com/reference/java/lang/CharSequence.html)` surroundingText) ` Sets the string within which the time difference will be displayed. |
| ` `[ComplicationText.TimeFormatBuilder](https://developer.android.com/reference/android/support/wearable/complications/ComplicationText.TimeFormatBuilder.html) | ` `[setTimeZone](https://developer.android.com/reference/android/support/wearable/complications/ComplicationText.TimeFormatBuilder.html#setTimeZone(java.util.TimeZone))`(`[TimeZone](http://developer.android.com/reference/java/util/TimeZone.html)` timeZone) ` Sets the time zone that will be used for the formatted time.                                         |

| ### Inherited methods |
|-----------------------|---|
| From class` `[java.lang.Object](http://developer.android.com/reference/java/lang/Object.html)` ` |------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------| | ` `[Object](http://developer.android.com/reference/java/lang/Object.html)          | ` clone() `                                                                               | | ` boolean`                                                                         | ` equals(`[Object](http://developer.android.com/reference/java/lang/Object.html)` arg0) ` | | ` void`                                                                            | ` finalize() `                                                                            | | ` final `[Class](http://developer.android.com/reference/java/lang/Class.html)`<?>` | ` getClass() `                                                                            | | ` int`                                                                             | ` hashCode() `                                                                            | | ` final void`                                                                      | ` notify() `                                                                              | | ` final void`                                                                      | ` notifyAll() `                                                                           | | ` `[String](http://developer.android.com/reference/java/lang/String.html)          | ` toString() `                                                                            | | ` final void`                                                                      | ` wait(long arg0, int arg1) `                                                             | | ` final void`                                                                      | ` wait(long arg0) `                                                                       | | ` final void`                                                                      | ` wait() `                                                                                | ||

## Public constructors

### TimeFormatBuilder

```
public TimeFormatBuilder ()
```

<br />

<br />

## Public methods

### build

```
public ComplicationText build ()
```

Returns[ComplicationText](https://developer.android.com/reference/android/support/wearable/complications/ComplicationText.html)including the formatted time as specified.

<br />

|                                                             Returns                                                              ||
|--------------------------------------------------------------------------------------------------------------------------|--------|
| [ComplicationText](https://developer.android.com/reference/android/support/wearable/complications/ComplicationText.html) | <br /> |

### setFormat

```
public ComplicationText.TimeFormatBuilder setFormat (String format)
```

Sets the format that should be applied to the date. This should be a pattern as used by[SimpleDateFormat](http://developer.android.com/reference/java/text/SimpleDateFormat.html).

<br />

|        Parameters         ||
|----------|-----------------|
| `format` | `String` <br /> |

|                                                                               Returns                                                                                ||
|--------------------------------------------------------------------------------------------------------------------------------------------------------------|--------|
| [ComplicationText.TimeFormatBuilder](https://developer.android.com/reference/android/support/wearable/complications/ComplicationText.TimeFormatBuilder.html) | <br /> |

### setStyle

```
public ComplicationText.TimeFormatBuilder setStyle (int style)
```

Sets the style in which the time format part will be displayed. If not set, defaults to[ComplicationText.FORMAT_STYLE_DEFAULT](https://developer.android.com/reference/android/support/wearable/complications/ComplicationText.html#FORMAT_STYLE_DEFAULT), which leaves the formatted date unchanged.

<br />

|      Parameters       ||
|---------|--------------|
| `style` | `int` <br /> |

|                                                                                             Returns                                                                                             ||
|--------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------|
| [ComplicationText.TimeFormatBuilder](https://developer.android.com/reference/android/support/wearable/complications/ComplicationText.TimeFormatBuilder.html) | this builder for chaining. <br /> |

**See also:**

- [ComplicationText.FORMAT_STYLE_DEFAULT](https://developer.android.com/reference/android/support/wearable/complications/ComplicationText.html#FORMAT_STYLE_DEFAULT)
- [ComplicationText.FORMAT_STYLE_UPPER_CASE](https://developer.android.com/reference/android/support/wearable/complications/ComplicationText.html#FORMAT_STYLE_UPPER_CASE)
- [ComplicationText.FORMAT_STYLE_LOWER_CASE](https://developer.android.com/reference/android/support/wearable/complications/ComplicationText.html#FORMAT_STYLE_LOWER_CASE)  

### setSurroundingText

```
public ComplicationText.TimeFormatBuilder setSurroundingText (CharSequence surroundingText)
```

Sets the string within which the time difference will be displayed. This is optional.

Within the text,`^1`will be replaced with the time difference, so for example to show a result like`"2 mins: meeting"`the surrounding text would be`"^1:
meeting"`.

To use the`^`character within the text, escape it as`^^`.

<br />

|                                                                     Parameters                                                                      ||
|-------------------|----------------------------------------------------------------------------------------------------------------------------------|
| `surroundingText` | `CharSequence`: string within which the time difference value will be displayed, with`^1`in place of the time difference. <br /> |

|                                                                                             Returns                                                                                             ||
|--------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------|
| [ComplicationText.TimeFormatBuilder](https://developer.android.com/reference/android/support/wearable/complications/ComplicationText.TimeFormatBuilder.html) | this builder for chaining. <br /> |

### setTimeZone

```
public ComplicationText.TimeFormatBuilder setTimeZone (TimeZone timeZone)
```

Sets the time zone that will be used for the formatted time. This is optional - if not set, the system's default time zone will be used.

<br />

|          Parameters           ||
|------------|-------------------|
| `timeZone` | `TimeZone` <br /> |

|                                                                                             Returns                                                                                             ||
|--------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------|
| [ComplicationText.TimeFormatBuilder](https://developer.android.com/reference/android/support/wearable/complications/ComplicationText.TimeFormatBuilder.html) | this builder for chaining. <br /> |