Hello! How can i execute task at a specific time w...
# announcements
a
Hello! How can i execute task at a specific time with Kotlin? Wich way is better?
m
not sure if its a better way. probably solution would depend on a target where your code is run (server, mobile?). my first idea would be to use coroutines and call
delay(plannedRunTimeMilliseconds - now())
s
If you’re using Spring, you can use the @Scheduled annotation. And if not you can always just use
Timer
and
TimeTask
in
java.util
. https://docs.oracle.com/javase/7/docs/api/java/util/Timer.html
a
thx, guys. It will be little script so i decide to use java.util