How to force R to have default timezone "Europe/Paris" on as.Date functions?
I tried:
Sys.setenv(tz='Europe/Paris') at the top of the script file - doesn't work
Would like to avoid adding a suffix tz="Europe/Paris" to every single as.Date call
EXAMPLE:
I have a function that pulls data from SQL database:
historyDateStart=toupper(format(as.POSIXlt(strptime(historyDateStart, "%d-%b-%y")),"%d-%b-%y"))
query=paste("SELECT price
FROM price_history
WHERE date_field BETWEEN TO_DATE('",
historyDateStart,
"', 'dd-MON-yy') AND TO_DATE('",
historyDateEnd,
"', 'dd-MON-yy')
ORDER BY date_field ",sep="")
data=getoracledata(query,databaseName)
If I don't add tz="Europe/Paris" to as.Date functions then I'm getting data with time 23:00:00 & day before. That's even if I run the env.put before running this.