Closed nathanfr closed 8 years ago
Thanks. I want to know for sure this is not system dependent. What is your
Sys.getlocale()
When I use %m/%d/%Y format it throws an error: ERROR: Incorrect Start Date. So I believe this is locale dependent. Can you provide insights on your locale?
Gotcha. Here's the output from Sys.getlocale()
LC_COLLATE=English_United States.1252;LC_CTYPE=English_United States.1252;LC_MONETARY=English_United States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252
Here is mine: LC_COLLATE=Dutch_Netherlands.1252;LC_CTYPE=Dutch_Netherlands.1252;LC_MONETARY=Dutch_Netherlands.1252;LC_NUMERIC=C;LC_TIME=Dutch_Netherlands.1252
Any suggestions on how to fix this for all locales?
I've made a change to the RStudio add-in to incorporate the possibility to set the date formatting any locale. I'm going to leave the defaults of taskscheduler_create to "%d/%m/%Y". Added more info in the docs on that. You can use the RStudio add-in to change this. Please test. thanks for the remark on the date locale thing
Sure. Thanks.
Side note: this should automatically pick up locale specific date formatting:
startdate = format(Sys.Date(), "%x")
Good to know. Can you look if the default of gsub("-", "/", format(Sys.Date(), "%x"))
works on your computer?
Works great. But it looks like for US locale the output of format(Sys.Date(), "%x")
and gsub("-", "/", format(Sys.Date(), "%x"))
are actually the same.
"3/25/2016"
For me this gives
format(Sys.Date(), "%x")
[1] "25-3-2016"
and when running
taskscheduler_create(taskname = "myfancyscript", rscript = myscript,
schedule = "WEEKLY", starttime = format(Sys.time() + 62, "%H:%M"),
startdate = format(Sys.Date(), "%x"))
i get ERROR: Invalid Start Date (Date should be in \"dd/mm/yyyy\" format).\r
Old default date format ("%d/%m/%Y") throws error. Fixed by changing date format to "%m/%d/%Y"
Old default was causing problems when I tried to schedule a weekly task. Oddly not a one time task. But both appear to work just fine with the proposed change.