I have a POSIXct
object and would like to change it\'s tz
attribute WITHOUT R to interpret it (interpret it would mean to change how the datetime is di
To change the tz
attribute of a POSIXct
variable it is not best practice to convert to character or numeric and then back to POSIXct
. Instead you could use the force_tz
function of the lubridate
package
library(lubridate)
datetime2 <- force_tz(datetime, tzone = "CET")
datetime2
attributes(datetime2)