Skip to content

Date formatting in other calendar than English #389

Answered by JanMarvin
asltjoey asked this question in Q&A
Discussion options

You must be logged in to vote

Hi Joe,

thanks for your kind words, had to laugh at the supergeil part (do you speak any German?). To answer your question, its possible to so in openxlsx2 (and also in openxlsx)!

library(openxlsx2)

wb <- wb_workbook() %>% 
  wb_add_worksheet("Rawdata") %>% 
  wb_add_data(x = Sys.Date(), colNames = FALSE) %>% 
  wb_add_numfmt( numfmt = "[$-1070000]d/mm/yyyy;@") %>% 
  wb_open()

You can also set your date format to thai with the `openxlsx2.

options("openxlsx2.dateFormat" = "[$-1070000]d/mm/yyyy;@")

I got the correct date format string this way: create a formatted file in Excel, load it with wb_load() and inspecting the correct numfmt found in wb$styles_mgr$styles$numFmts.

Unfortunately, …

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by JanMarvin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
documentation ✍️ Improvements or additions to documentation
2 participants