Stay organized with collections
Save and categorize content based on your preferences.
RelativeUnit
class RelativeUnit
Represents the unit for formatting a relative date. e.g "in 5 days" or "in 3 months"
Summary
Enum values |
Days
|
Hours
|
Minutes
|
Months
|
Seconds
|
Weeks
|
Years
|
Enum values
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 2025-02-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[],null,["# RelativeDateTimeFormatter.RelativeUnit\n\nAdded in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nRelativeUnit\n============\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/icu/text/RelativeDateTimeFormatter.RelativeUnit \"View this page in Java\") \n\n```\nclass RelativeUnit\n```\n\n|---|---|--------------------------------------------------------------|\n| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) |||\n| ↳ | [kotlin.Enum](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-enum/index.html)\\\u003c[android.icu.text.RelativeDateTimeFormatter.RelativeUnit](#)\\\u003e ||\n| | ↳ | [android.icu.text.RelativeDateTimeFormatter.RelativeUnit](#) |\n\n|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Known Direct Subclasses [RelativeDateTimeFormatter.RelativeUnit.DAYS](#ENUM_VALUE:DAYS), [RelativeDateTimeFormatter.RelativeUnit.HOURS](#ENUM_VALUE:HOURS), [RelativeDateTimeFormatter.RelativeUnit.MINUTES](#ENUM_VALUE:MINUTES), [RelativeDateTimeFormatter.RelativeUnit.MONTHS](#ENUM_VALUE:MONTHS), [RelativeDateTimeFormatter.RelativeUnit.SECONDS](#ENUM_VALUE:SECONDS), [RelativeDateTimeFormatter.RelativeUnit.WEEKS](#ENUM_VALUE:WEEKS), [RelativeDateTimeFormatter.RelativeUnit.YEARS](#ENUM_VALUE:YEARS) |-----------------------------------------------------------------------|---------| | [RelativeDateTimeFormatter.RelativeUnit.DAYS](#ENUM_VALUE:DAYS) | Days | | [RelativeDateTimeFormatter.RelativeUnit.HOURS](#ENUM_VALUE:HOURS) | Hours | | [RelativeDateTimeFormatter.RelativeUnit.MINUTES](#ENUM_VALUE:MINUTES) | Minutes | | [RelativeDateTimeFormatter.RelativeUnit.MONTHS](#ENUM_VALUE:MONTHS) | Months | | [RelativeDateTimeFormatter.RelativeUnit.SECONDS](#ENUM_VALUE:SECONDS) | Seconds | | [RelativeDateTimeFormatter.RelativeUnit.WEEKS](#ENUM_VALUE:WEEKS) | Weeks | | [RelativeDateTimeFormatter.RelativeUnit.YEARS](#ENUM_VALUE:YEARS) | Years | |\n\nRepresents the unit for formatting a relative date. e.g \"in 5 days\" or \"in 3 months\"\n\nSummary\n-------\n\n| Enum values ||\n|----------------------------------------|---|\n| [DAYS](#ENUM_VALUE:DAYS) Days |\n| [HOURS](#ENUM_VALUE:HOURS) Hours |\n| [MINUTES](#ENUM_VALUE:MINUTES) Minutes |\n| [MONTHS](#ENUM_VALUE:MONTHS) Months |\n| [SECONDS](#ENUM_VALUE:SECONDS) Seconds |\n| [WEEKS](#ENUM_VALUE:WEEKS) Weeks |\n| [YEARS](#ENUM_VALUE:YEARS) Years |\n\nEnum values\n-----------\n\n### DAYS\n\nAdded in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nenum val DAYS : RelativeDateTimeFormatter.RelativeUnit\n```\n\nDays \n\n### HOURS\n\nAdded in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nenum val HOURS : RelativeDateTimeFormatter.RelativeUnit\n```\n\nHours \n\n### MINUTES\n\nAdded in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nenum val MINUTES : RelativeDateTimeFormatter.RelativeUnit\n```\n\nMinutes \n\n### MONTHS\n\nAdded in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nenum val MONTHS : RelativeDateTimeFormatter.RelativeUnit\n```\n\nMonths \n\n### SECONDS\n\nAdded in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nenum val SECONDS : RelativeDateTimeFormatter.RelativeUnit\n```\n\nSeconds \n\n### WEEKS\n\nAdded in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nenum val WEEKS : RelativeDateTimeFormatter.RelativeUnit\n```\n\nWeeks \n\n### YEARS\n\nAdded in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nenum val YEARS : RelativeDateTimeFormatter.RelativeUnit\n```\n\nYears"]]