This gives back a UTC time zone even if the original was in the local time zone. duckdb has an icu extension and TIMESTAMPTZ type which may solve this. Not sure.
library(duckdb)
con <- dbConnect(duckdb())
d <- data.frame(d = as.POSIXct("2000-01-01 12:13:14"))
duckdb_register(con, "d", d)
out <- dbGetQuery(con, "from d")
## d
## 1 2000-01-01 17:13:14
dput(out)
## structure(list(d = structure(946746794, class = c("POSIXct",
## "POSIXt"), tzone = "UTC")), class = "data.frame", row.names = c(NA, <--------------- note UTC
## -1L))
dput(d)
## structure(list(d = structure(946746794, class = c("POSIXct",
## "POSIXt"), tzone = "")), class = "data.frame", row.names = c(NA,
## -1L))
This gives back a UTC time zone even if the original was in the local time zone. duckdb has an icu extension and TIMESTAMPTZ type which may solve this. Not sure.