library(shiny)
library(DT)
library(dplyr)
library(magrittr)
# server-side processing
base<-as.POSIXct('2000-01-01 00:00:00 EST')
mtcars2 = mtcars[, 5:6]
mtcars2 %<>%
mutate(drat = base+(3600*drat),
wt = base+(3600*wt))
DT::datatable(mtcars2,
extensions = 'Buttons',
options = list(
scrollX = TRUE,
scrollY = TRUE,
pageLength = 10,
dom = 'Blfrtip',
buttons = c('copy', 'csv', 'excel', 'pdf', 'print')
)
) %>%
formatDate( 1:2,method = 'toLocaleTimeString', params = list('en-US',hour = 'numeric', hour12 = 'true', minute = 'numeric'))
formatDate(1:2, method = 'toLocaleTimeString',
params = list('en-US', list(hour = 'numeric', minute = 'numeric', hour12 = FALSE)))DT::datatable(mtcars2,
extensions = 'Buttons',
options = list(
scrollX = TRUE,
scrollY = TRUE,
pageLength = 10,
dom = 'Blfrtip',
buttons = c('copy', 'csv', 'excel', 'pdf', 'print'),
columnDefs = list(
list(targets = c(1, 2), render = JS("
function(data) {
return data.slice(-9, -4);
}"))
)
)
)