TimeFormatComplicationText
public
final
class
TimeFormatComplicationText
extends Object
implements
TimeDependentText
| java.lang.Object | |
| ↳ | com.google.wear.services.complications.TimeFormatComplicationText |
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 DynamicComplicationText. That will be the only supported way to create this type of ComplicationText in the future.
Summary
Nested classes | |
|---|---|
class |
TimeFormatComplicationText.Builder
Builder for |
Constants | |
|---|---|
int |
STYLE_DEFAULT
Style where the formatted date/time should be shown unchanged. |
int |
STYLE_LOWER_CASE
Style where the formatted date/time should be shown in lower case. |
int |
STYLE_UPPER_CASE
Style where the formatted date/time should be capitalized. |
Public constructors | |
|---|---|
TimeFormatComplicationText(CharSequence surroundingText, String format, int style, TimeZone timeZone)
|
|
Public methods | |
|---|---|
boolean
|
equals(Object o)
|
SimpleDateFormat
|
getFormat()
|
String
|
getFormatString()
|
long
|
getNextChangeTimeMillis(long fromTime)
Returns the next time after |
long
|
getPrecisionMillis()
|
int
|
getStyle()
Returns the time format style to be used when formatting the text. |
CharSequence
|
getSurroundingText()
|
TimeZone
|
getTimeZone()
|
int
|
hashCode()
|
boolean
|
returnsSameTextAt(long firstDateTimeMillis, long secondDateTimeMillis)
Returns true if the result of the calculation of the current text will be the same for both
|
String
|
toString()
|
Inherited methods | |
|---|---|
Constants
STYLE_DEFAULT
public static final int STYLE_DEFAULT
Style where the formatted date/time should be shown unchanged.
Constant Value: 1 (0x00000001)
STYLE_LOWER_CASE
public static final int STYLE_LOWER_CASE
Style where the formatted date/time should be shown in lower case.
Constant Value: 3 (0x00000003)
STYLE_UPPER_CASE
public static final int STYLE_UPPER_CASE
Style where the formatted date/time should be capitalized.
Constant Value: 2 (0x00000002)
Public constructors
TimeFormatComplicationText
public TimeFormatComplicationText (CharSequence surroundingText,
String format,
int style,
TimeZone timeZone)| Parameters | |
|---|---|
surroundingText |
CharSequence |
format |
String |
style |
int: Value is one of the following:
|
timeZone |
TimeZone |
Public methods
getNextChangeTimeMillis
public long getNextChangeTimeMillis (long fromTime)
Returns the next time after fromTime at which the text may change.
| Parameters | |
|---|---|
fromTime |
long |
| Returns | |
|---|---|
long |
|
getPrecisionMillis
public long getPrecisionMillis ()
| Returns | |
|---|---|
long |
The time precision in milliseconds derived from the date and time format. |
getStyle
public int getStyle ()
Returns the time format style to be used when formatting the text.
| Returns | |
|---|---|
int |
Value is one of the following: |
getSurroundingText
public CharSequence getSurroundingText ()
| Returns | |
|---|---|
CharSequence |
|
returnsSameTextAt
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.
| Parameters | |
|---|---|
firstDateTimeMillis |
long |
secondDateTimeMillis |
long |
| Returns | |
|---|---|
boolean |
|
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2026-06-11 UTC.