epochSeconds

actual val epochSeconds: Long(source)
expect val epochSeconds: Long(source)

The number of seconds from the epoch instant 1970-01-01T00:00:00Z rounded down to a Long number.

The difference between the rounded number of seconds and the actual number of seconds is returned by nanosecondsOfSecond property expressed in nanoseconds.

Note that this number doesn't include leap seconds added or removed since the epoch.

See also

Samples

import kotlinx.datetime.*
import kotlinx.datetime.format.*
import kotlin.random.*
import kotlin.test.*
import kotlin.time.Duration.Companion.hours
fun main() { 
   //sampleStart 
   // Getting the number of whole seconds that passed since the Unix epoch
val instant1 = Instant.fromEpochSeconds(999_999, nanosecondAdjustment = 123_456_789)
check(instant1.epochSeconds == 999_999L)
val instant2 = Instant.fromEpochSeconds(1_000_000, nanosecondAdjustment = 100_123_456_789)
check(instant2.epochSeconds == 1_000_000 + 100L)
val instant3 = Instant.fromEpochSeconds(1_000_000, nanosecondAdjustment = -100_876_543_211)
check(instant3.epochSeconds == 1_000_000 - 101L) 
   //sampleEnd
}
actual val epochSeconds: Long(source)
actual val epochSeconds: Long(source)