我想在我的闪亮App中显示当前时间。因此,我可以使用Sys.time()
。
function(input, output, session) {
output$currentTime <- renderText({
invalidateLater(1000, session)
paste("The current time is", Sys.time())
})
}
我想知道是否可以根据当前时间编写倒计时器,例如针对即将到来的事件?
EventTime <- Sys.time() + 4*60
output$eventTimeRemaining <- renderText({
invalidateLater(1000, session)
paste("The time remaining for the Event:",
round(difftime(EventTime, Sys.time(), units='secs')), 'secs')
})
The time remaining for the Event: 226 secs