Timestamp

actual class Timestamp(seconds: Long, nanoseconds: Int) : Comparable<Timestamp> (source)
expect class Timestamp(seconds: Long, nanoseconds: Int) : Comparable<Timestamp> (source)

A point in time with nanosecond precision, mirroring com.google.firebase.Timestamp from the Firebase Android SDK.

The Date and Instant constructors, toDate and toInstant keep the SDK's signatures through the error-deprecated java.util.Date and java.time.Instant stand-ins and can only be called from Android/JVM code: from common code they fail to compile with a message naming the kotlin.time.Instant counterparts, the top-level Timestamp(Instant) function and toKotlinInstant. The Parcelable members are not mirrored.

Parameters

seconds

seconds since the Unix epoch, between -62135596800 and 253402300799 inclusive

nanoseconds

fraction of a second in nanoseconds, between 0 and 999999999 inclusive

actual class Timestamp(seconds: Long, nanoseconds: Int) : Comparable<Timestamp> (source)
actual class Timestamp(val seconds: Long, val nanoseconds: Int) : Comparable<Timestamp> (source)

Constructors

Link copied to clipboard
actual constructor(date: Date)
actual constructor(time: Instant)
actual constructor(seconds: Long, nanoseconds: Int)
expect constructor(date: Date)

Android/JVM only: the Timestamp(Date) constructor; use Timestamp(kotlin.time.Instant) from common code.

expect constructor(time: Instant)

Android/JVM only: the Timestamp(Instant) constructor; use Timestamp(kotlin.time.Instant) from common code.

expect constructor(seconds: Long, nanoseconds: Int)
actual constructor(date: Date)
actual constructor(time: Instant)
actual constructor(seconds: Long, nanoseconds: Int)
actual constructor(date: Date)
actual constructor(time: Instant)
actual constructor(seconds: Long, nanoseconds: Int)

Types

Link copied to clipboard
actual object Companion
expect object Companion
actual object Companion
actual object Companion

Properties

Link copied to clipboard
actual val nanoseconds: Int
expect val nanoseconds: Int

Fraction of a second in nanoseconds.

actual val nanoseconds: Int
actual val nanoseconds: Int
Link copied to clipboard
actual val seconds: Long
expect val seconds: Long

Seconds since the Unix epoch.

actual val seconds: Long
actual val seconds: Long

Functions

Link copied to clipboard
actual open operator override fun compareTo(other: Timestamp): Int
expect open operator override fun compareTo(other: Timestamp): Int
actual open operator override fun compareTo(other: Timestamp): Int
actual open operator override fun compareTo(other: Timestamp): Int
Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
actual fun toDate(): Date
expect fun toDate(): Date

Android/JVM only: this timestamp as a java.util.Date; use toKotlinInstant from common code.

actual fun toDate(): Date
actual fun toDate(): Date
Link copied to clipboard
actual fun toInstant(): Instant
expect fun toInstant(): Instant

Android/JVM only: this timestamp as a java.time.Instant; use toKotlinInstant from common code.

actual fun toInstant(): Instant
actual fun toInstant(): Instant
Link copied to clipboard
fun Timestamp.toKotlinInstant(): <Error class: unknown class>

This timestamp as a kotlin.time.Instant, the multiplatform form of the JVM-only toInstant() and toDate().

Link copied to clipboard
open override fun toString(): String