Just like most people, time date format is also not my favorite topic in R, and is once again giving me more trouble than I bargained for.
In follow-up of this question: SO
I got rid of the 'T' and 'Z' with 'toLocaleString'
but now my datatable
is showing times in AM and PM, while I just want to see the original 24h times.
I'm running the app in google chrome, and my output looks like this at the moment:
library(shiny)
library(DT)
data <- structure(list(DATUM = structure(c(1490738402, 1490738436, 1490738440,
1490738444, 1490738447, 1490738451, 1490738455, 1490738459, 1490738463,
1490738467), class = c("POSIXct", "POSIXt"), tzone = "CEST"), NUMMER = c(19,
20, 21, 22, 23, 24, 25, 26, 27, 28)), .Names = c("DATUM", "NUMMER"), row.names = c(NA, 10L), class = "data.frame")
tz <- Sys.timezone()
data$DATUM <- as.POSIXct(as.character(data$DATUM), tz=tz)
ui=fluidPage(
dataTableOutput("tab")
)
server= function(input, output,session) {
output$tab <- DT::renderDataTable({
datatable(data,rownames=TRUE, filter="top", class = 'cell-border stripe') %>%
formatDate(1, method = 'toLocaleString')})
}
shinyApp(ui, server)