2024-08-30 14:24:46 +08:00
|
|
|
/*
|
|
|
|
|
* Copyright © 2024 RTAkland
|
|
|
|
|
* Author: RTAkland
|
|
|
|
|
* Date: 2024/8/29
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
2024-10-09 13:06:43 +08:00
|
|
|
package cn.rtast.fancybot.util.misc
|
2024-08-30 14:24:46 +08:00
|
|
|
|
|
|
|
|
import java.time.Instant
|
|
|
|
|
import java.time.ZoneId
|
|
|
|
|
|
2024-09-02 11:30:58 +08:00
|
|
|
fun Long.isSameDay(timestamp2: Long): Boolean {
|
|
|
|
|
val zoneId = ZoneId.of("Asia/Shanghai")
|
|
|
|
|
val date1 = Instant.ofEpochSecond(this).atZone(zoneId).toLocalDate()
|
|
|
|
|
val date2 = Instant.ofEpochSecond(timestamp2).atZone(zoneId).toLocalDate()
|
|
|
|
|
return date1 == date2
|
2024-08-30 14:24:46 +08:00
|
|
|
}
|