DateFormatter

interface DateFormatter

A class for formatting Instant and Date objects into common String formats.

Inheritors

Functions

Link copied to clipboard
@RequiresApi(value = 26)
abstract fun iso8601Local(instant: Instant, timeZone: ZoneId): String
abstract fun iso8601Local(date: Date, timeZone: TimeZone): String

Returns an ISO-8601 date format using device default as the time zone

Link copied to clipboard
@RequiresApi(value = 26)
abstract fun iso8601LocalWithOffset(instant: Instant, timeZone: ZoneId): String
abstract fun iso8601LocalWithOffset(date: Date, timeZone: TimeZone): String

Returns an ISO-8601 date format using device default as the time zone, including the timezone offset.

Link copied to clipboard
@RequiresApi(value = 26)
abstract fun iso8601Utc(instant: Instant): String
abstract fun iso8601Utc(date: Date): String

Returns an ISO-8601 date format using UTC as the time zone

Link copied to clipboard
@RequiresApi(value = 26)
abstract fun offsetInHours(instant: Instant, timeZone: ZoneId): Double
abstract fun offsetInHours(date: Date, timeZone: TimeZone): Double

Returns the timezone offset in hours, as a Double. Where the integral part of the returned Double is the whole number of hours, and the fractional part is the minutes.