We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
TimeFormat.atInstant
kotlin.time.Instant
1 parent c156724 commit 8d28cd2Copy full SHA for 8d28cd2
BotCommands-jda-ktx/src/main/kotlin/dev/freya02/botcommands/jda/ktx/utils/TimeFormat.kt
@@ -0,0 +1,19 @@
1
+package dev.freya02.botcommands.jda.ktx.utils
2
+
3
+import net.dv8tion.jda.api.utils.TimeFormat
4
+import net.dv8tion.jda.api.utils.Timestamp
5
+import kotlin.time.Instant
6
+import kotlin.time.toJavaInstant
7
8
+/**
9
+ * Converts the provided [Instant] into a [Timestamp] with this style.
10
+ *
11
+ * @param instant
12
+ * The [Instant] for the timestamp
13
14
+ * @return The [Timestamp] instance
15
16
+ * @see TimeFormat.now
17
+ * @see TimeFormat.atTimestamp
18
+ */
19
+fun TimeFormat.atInstant(instant: Instant) = atInstant(instant.toJavaInstant())
0 commit comments