[英]date format change with DT and shiny
我的問題是當我在我的計算機上使用datatable並且在服務器上formatDate
正在改變我知道我正在使用method = 'toLocaleDateString'
也許這不是好方法
在我的電腦上它給我我想要的格式:
1 février 2000
21 mars 2000
閃亮它給我:
01/02/2000
21/03/2000
本地計算機和服務器有Sys.timezone()
[1] "Europe/Paris"
我想這樣做
a <-structure(list(timestamp = structure(c(949363200, 953596800,
961286400, 962582400, 965347200, 969667200),
class = c("POSIXct", "POSIXt"), tzone = "UTC"),
anoms = c(1, 1, 1, 1, 1, 2), syndrome = c("Acrosyndrome",
"Acrosyndrome", "Acrosyndrome", "Acrosyndrome", "Acrosyndrome",
"Acrosyndrome")), .Names = c("timestamp", "anoms", "syndrome"
), row.names = c(NA, 6L), class = "data.frame")
datatable(a) %>% formatDate( 1, method = 'toLocaleDateString')
a
謝謝
使用Github上的DT (> = 0.2.2)的開發版本 ,您可以將其他參數傳遞給日期轉換方法,例如
datatable(a) %>%
formatDate(1, method = 'toLocaleDateString', params = list('fr-FR'))
或更多參數:
datatable(a) %>% formatDate(
1, method = 'toLocaleDateString',
params = list('fr-FR', list(year = 'numeric', month = 'long', day = 'numeric'))
)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.