How can I get current time in Unix Timestamp format in kotlin as integer?
How can I get current time in Unix Timestamp format in kotlin as integer?
If you're using Kotlin on the JVM or Android, it's as simple as
val unixTime = System.currentTimeMillis();
for the unix time in milliseconds, or
val unixTime = System.currentTimeMillis() / 1000;
for the unix time in seconds (rounded down).