shinyTime

Published onesixx on

https://cran.r-project.org/web/packages/shinyTime/index.html

server = function(input, output,session) { }

ui <- fluidPage(
  # Default value is 00:00:00
  timeInput("time1", "Time:"),
  
  # Set to current time
  timeInput("time2", "Time:", value = Sys.time()),
  
  # Set to custom time
  timeInput("time3", "Time:", value = strptime("12:34:56", "%T")),
  
  # Use %H:%M format
  timeInput("time4", "Time:", seconds = FALSE)
)

shinyApp(ui, server)

 

ui <- fluidPage(
  timeInput("timeVal", "Time:"),
  actionButton("to_current_time", "Current time")
)

server <- function(input, output, session) {
  observeEvent(input$to_current_time, {
    updateTimeInput(session, "timeVal", value = Sys.time())
  })
}

shinyApp(ui, server)

 

 

Categories: Shiny

onesixx

Blog Owner

Leave a Reply

Your email address will not be published.